我想編寫一個簡單的VB腳本來在Windows中自動關閉。CMD in vbscript
我使用的代碼是:
Dim ti
ti=InputBox("enter time in minutes")
ti=ti*60
Set objShell=CreateObject("WScript.Shell")
objShell.Run "cmd shutdown /s /t "& ti & " "
但是當我輸入時間,然後按回車,我得到的是一個命令提示符窗口,然後什麼也沒有發生通過設置默認
我甚至嘗試時間價值和specifing爲shutdown.exe的完整路徑,但似乎沒有被工作
Set WshShell = WScript.CreateObject("WScript.Shell")
Command = "C:\Windows\System32 shutdown.exe -s -t 600 "
WshShell.Run Command
u能請糾正我,引導我朝着正確的代碼....
'cmd'不帶這樣的參數。查看'cmd /?'的使用情況。 – SLaks 2013-04-21 21:16:22
當我使用完整路徑和默認值時,文件夾C:\ windows \ System32打開並且沒有任何反應。 – kid 2013-04-21 21:16:42