vbscript - run a file with paramters
Im trying to call an executable via a vbscript
I can call an exe via,
Set wshShell = WScript.CreateObject ("WSCript.shell")
wshshell.run "N:\myapp.exe", 6, True
set wshshell = nothing
But originally a shortcut was added to desktop that call the same exe but with a few more details, such as
Shortcut Target = "N:\Program Files\MapInfo\Professional\MAPINFOW.EXE" "N:\Program Files\CDATA 2001 Release 2\CDATA2001.MBX"
Shortcut Start In Traget = "N:\Program Files\CDATA 2001 Release 2"
Im wondering how do i add those details and run the exe in vbs or if its possible to call a shortcut with in vbscript.
Cheers,
Ry
I can call an exe via,
Set wshShell = WScript.CreateObject ("WSCript.shell")
wshshell.run "N:\myapp.exe", 6, True
set wshshell = nothing
But originally a shortcut was added to desktop that call the same exe but with a few more details, such as
Shortcut Target = "N:\Program Files\MapInfo\Professional\MAPINFOW.EXE" "N:\Program Files\CDATA 2001 Release 2\CDATA2001.MBX"
Shortcut Start In Traget = "N:\Program Files\CDATA 2001 Release 2"
Im wondering how do i add those details and run the exe in vbs or if its possible to call a shortcut with in vbscript.
Cheers,
Ry
0 Comments
[ + ] Show comments
Answers (2)
Please log in to answer
Posted by:
WiseUser
19 years ago
It should look something like this... although I haven't tested it.
Set oWsh = CreateObject ("Wscript.Shell")
sProgFiles = oWsh.ExpandEnvironmentStrings("%ProgramFiles%")
sAppPath = sProgFiles & "\MapInfo\Professional\MAPINFOW.EXE"
sDocPath = sProgFiles & "\CDATA 2001 Release 2\CDATA2001.MBX"
sStartPath = sProgFiles & \CDATA 2001 Release 2"
oWsh.CurrentDirectory = sStartPath
oWsh.Run Chr(34) & sAppPath & Chr(34) & " " & Chr(34) & sDocPath & Chr(34), 5, True
Set oWsh = Nothing
sProgFiles = oWsh.ExpandEnvironmentStrings("%ProgramFiles%")
sAppPath = sProgFiles & "\MapInfo\Professional\MAPINFOW.EXE"
sDocPath = sProgFiles & "\CDATA 2001 Release 2\CDATA2001.MBX"
sStartPath = sProgFiles & \CDATA 2001 Release 2"
oWsh.CurrentDirectory = sStartPath
oWsh.Run Chr(34) & sAppPath & Chr(34) & " " & Chr(34) & sDocPath & Chr(34), 5, True
Set oWsh = Nothing
Posted by:
ryath
19 years ago
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.