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.

0 Comments   [ - ] Hide Comments


Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
Answer this question or Comment on this question for clarity


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
Answered 09/28/2005 by: WiseUser
Fourth Degree Brown Belt

Please log in to comment
Hi WiseUser

Thanks very much for the info!
That worked perfectly!

Answered 09/28/2005 by: ryath
Orange Belt

Please log in to comment