您好我試圖發送命令「關機」到已打開的命令提示符稱爲管理員:交易服務器使用BAT文件,但是當我運行BAT文件什麼也沒有發生。使用批處理文件將命令發送到CMD.exe
我跟着這個問題 - How to execute a command in already open CMD window using VBScirpt
有誰知道爲什麼嗎?
這裏是我的代碼:
:: s
SendMessage-1.1.2.exe /windowtitle:"Test Server" /message:WM_CHAR /wparam:115 /lparam:1
:: h
SendMessage-1.1.2.exe /windowtitle:"Test Server" /message:WM_CHAR /wparam:104 /lparam:1
:: u
SendMessage-1.1.2.exe /windowtitle:"Test Server" /message:WM_CHAR /wparam:117 /lparam:1
:: t
SendMessage-1.1.2.exe /windowtitle:"Test Server" /message:WM_CHAR /wparam:116 /lparam:1
:: d
SendMessage-1.1.2.exe /windowtitle:"Test Server" /message:WM_CHAR /wparam:100 /lparam:1
:: o
SendMessage-1.1.2.exe /windowtitle:"Test Server" /message:WM_CHAR /wparam:111 /lparam:1
:: w
SendMessage-1.1.2.exe /windowtitle:"Test Server" /message:WM_CHAR /wparam:119 /lparam:1
:: n
SendMessage-1.1.2.exe /windowtitle:"Test Server" /message:WM_CHAR /wparam:110 /lparam:1
:: ENTER
SendMessage-1.1.2.exe /windowtitle:"Test Server" /message:WM_CHAR /wparam:13 /lparam:1
:: ENTER
SendMessage-1.1.2.exe /windowtitle:"Test Server" /message:WM_CHAR /wparam:13 /lparam:1
:: wait for some time (~3 sec) till the program shuts down, if necessary
PING -n 4 localhost 1>NUL
pause
...
我並不想在這裏是一個痛苦。只是有問題,他們應該只是這個問題。對你有用的東西可能與其他人稍有不同,所以他們可以添加答案。在這種情況下,只有一個答案,但並非總是如此。請不要在問題中添加「答案」文本。它有助於避免混淆。謝謝 – Bugs