用vbs从闪存驱动器运行程序

时间:2016-06-06 14:43:10

标签: vbscript

我试图让脚本从闪存驱动器执行程序,但它不起作用,这是我的脚本

Set wshShell = wScript.CreateObject("wScript.Shell")
Set objFSO = Createobject("Scripting.FileSystemObject")
For Each objDrive In objFSO.Drives
If objDrive.DriveType = 1 Then
wshShell.run objDrive.DriveLetter & "\ \Autoit\Scripts\Google Chrome\Delete.vbs"
End If
Next

1 个答案:

答案 0 :(得分:0)

嗨,大家刚刚通过我自己想出来,所以问题是objDrive.DriveLetter而不是使用那个我使用这个脚本并且工作正常哈哈谢谢

Set wshShell = wScript.CreateObject("wScript.Shell")
Set objFSO = Createobject("Scripting.FileSystemObject")
For Each objDrive In objFSO.Drives
If objDrive.DriveType = 1 Then
wshShell.run ("""\ \Autoit\Scripts\Google Chrome\Delete.vbs""")
End If
Next