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
0 Comments   [ + ] Show Comments

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.

Answers

0
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
0
Hi WiseUser

Thanks very much for the info!
That worked perfectly!

Cheers,
Ry
Answered 09/28/2005 by: ryath
Orange Belt

Please log in to comment
Answer this question or Comment on this question for clarity