Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

WScript.Run issues

Status
Not open for further replies.

bmquiroz

IS-IT--Management
Sep 26, 2003
207
US
I hope someone can help me with this. I've been trying to figure it out but run into a brick wall every time. I need to run a command and pass parameters to it, problem is the when I enclose the executable with double quotes I can't pipe additional parameters to it.

Heres the code:
WSHShell.Run "runas /u:NEO\administrator ""c:\VNCTemp\SetupRealVNC4.exe /SP- /VERYSILENT""" & "| sanur.exe password""",2,True

Heres what I need to run from a command shell:
runas /u:NEO\administrator "c:\VNCTemp\SetupRealVNC4.exe /SP- /VERYSILENT" | sanur.exe password

Thanks,

-Sip
 
I would try making the last """ be ".

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
Have you tried this ?
WSHShell.Run "cmd /c runas /u:NEO\administrator ""c:\VNCTemp\SetupRealVNC4.exe /SP- /VERYSILENT"" | sanur.exe password",2,True

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thanks guys but neither suggestion worked. I know its something with the double quotes just cant pin point it.
 
What i've used before is the chr(34) code to put in the quotes and it seems to work. Here is a sample of one of my lines to see how to implement chr(34).

oShell.Run chr(34) & "%logonserver%\NETLOGON\sc\reg.exe" & chr(34) & " delete " & chr(34) & "HKLM\" & strKeyPathHist & chr(34) & " /f", 0, True

Hope that helps.
 
And this ?
WSHShell.Run "runas /u:NEO\administrator ""cmd.exe /c c:\VNCTemp\SetupRealVNC4.exe /SP- /VERYSILENT | sanur.exe password""",2,True
The basic idea, as in my previous post, is that the pipe redirection must be handled by a shell.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Ok this works
WSHShell.Run "%comspec% /c ""runas /u:NEO\administrator c:\VNCTemp\SetupRealVNC4.exe | sanur password""",1,True
But when I add parameters (/SP- /VERYSILENT) to the exe it fails.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top