I am trying to run myFileToRun.bat file from a path, for example.
D:\My Folder\batchfiles\myFileToRun.bat
Below is the VBScript through which I am trying to run it.
Dim WshShell, strCurrentDirectory
Set WshShell = CreateObject("WScript.Shell")
strCurrentDirectory = WshShell.CurrentDirectory
WshShell.Run strCurrentDirectory & "\myFileToRun.bat" , 0
Set WshShell = Nothing
I canβt start it, because VBS fails to sayin "The system cannot find the specified file" error. I tried various methods mentioned in other similar posts in stackoverflow and other forums. Most of them say add double quotes.
Note. I tried adding double quotes, double double quotes like
1.WshShell.Run """strCurrentDirectory & "\myFileToRun.bat" "", 0
2.WshShell.Run """"strCurrentDirectory & "\myFileToRun.bat"""", 0
3.WshShell.Run """"strCurrentDirectory & \myFileToRun.bat"""", 0
, , . strCurrentDirectory "strCurrentDirectory" "D:\My Folder\batchfiles", "strCurrentDirectory" "\ myFileToRun.bat", . "D:\My Folder\batchfiles\myFileToRun.bat" .
.
, , .
: . , script.
Dim WshShell
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "myFileToRun.bat", 0
Set WshShell = Nothing
. .