
cmd窗口不顯示內容我也不知道是否應該在此處發帖.我在autohotkey代碼中調用cmd命令, 最終不得不用ComObj實現, 但我沒學過, 拼湊的, 不過最終還是dos命令.
abc是個3行文本, 代表3個命令本來運行的時候隱藏cmd窗口的, 我把exec := shell.Exec(ComSpec /Q /K echo off) 改成了 exec := shell.Exec(ComSpec /K echo on), cmd窗口出現了, 帶標題, 但內容始終是空, 而實際上運行正常高手教我nclick="copycode($('code0'));">復制代碼
- RunWaitMany(abc)
- RunWaitMany(commands) {
- shell := ComObjCreate(Wscript.Shell)
- ; Open cmd.exe with echoing of commands disabled
- exec := shell.Exec(ComSpec /K echo on)
- ; Send the commands to execute, separated by newline
- exec.StdIn.WriteLine(commands `nexit); Always exit at the end!
- ; Read and return the output of all commands
- return exec.StdOut.ReadAll()
- }

