/build/static/layout/Breadcrumb_cap_w.png

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

0 Comments   [ + ] Show comments

Answers (2)

Posted by: WiseUser 18 years ago
Fourth Degree Brown Belt
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
Posted by: ryath 18 years ago
Orange Belt
0
Hi WiseUser

Thanks very much for the info!
That worked perfectly!

Cheers,
Ry
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ