There is a VBS file in a folder and it uses the command below for launching an application:
WshShell.Run ".\Setup.exe"
lets name the vbs file to "Run.vbs" Now If I Create a batch script and put it in the same path it will work good:
WScript Run.vbs
But If I came back just one folder and then try to launch the vbs file, it will give me an error that the specific file not found:
WScript Setups\Run.vbs
So it means Run.vbs file can not execute WshShell.Run ".\Setup.exe" because it seems it is running from another location! Even If I make the path correct and full (like the below command) it will not work via the batch file!
WshShell.Run "C:\Folder\Setup.exe"
Where is the problem?
I even to try to fix the vbscript with the code below, but still it is not working if I launch it via batch script from another folder:
Set WshShell = WScript.CreateObject("WScript.Shell")
dim fso: set fso = CreateObject("Scripting.FileSystemObject")
dim CurrentDirectory
CurrentDirectory = fso.GetAbsolutePathName(".")
dim Directory
Directory = CurrentDirectory & "\Setup.exe"
WshShell.Run Chr(34) & Directory & Chr(34)