[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖

[其他] cmd窗口不显示内容?

我也不知道是否应该在此处发帖.

我在autohotkey代码中调用cmd命令, 最终不得不用ComObj实现, 但我没学过, 拼凑的, 不过最终还是dos命令.
  1. RunWaitMany(abc)
  2. RunWaitMany(commands) {
  3.     shell := ComObjCreate("WScript.Shell")
  4.     ; Open cmd.exe with echoing of commands disabled
  5.     exec := shell.Exec(ComSpec " /K echo on")
  6.     ; Send the commands to execute, separated by newline
  7.     exec.StdIn.WriteLine(commands "`nexit")  ; Always exit at the end!
  8.     ; Read and return the output of all commands
  9.     return exec.StdOut.ReadAll()
  10. }
复制代码
abc是个3行文本, 代表3个命令
本来运行的时候隐藏cmd窗口的, 我把exec := shell.Exec(ComSpec " /Q /K echo off") 改成了 exec := shell.Exec(ComSpec " /K echo on"), cmd窗口出现了, 带标题, 但内容始终是空, 而实际上运行正常

高手教我

返回列表