1
我試圖從VBScript中執行批處理命令。VBSCRIPT執行命令的文件
我想輸出寫入到文件中。
當我運行它,我沒有得到任何輸出到控制檯或文件。
我想:
Dim objShell, command
Set objShell = WScript.CreateObject ("WScript.shell")
command = "wmic product get Name > textfile.txt"
objShell.Run command, 0, True
Set objShell = Nothing
我在做什麼錯?
當我運行在命令提示符下鍵入命令wmic
它工作得很好。
你應該使用'CMD/C ...'不只是'CMD ...'。 –
我不使用/ C在我的實際腳本,但不作出正確的在所有情況下。我想保持答案一般。 – ajon