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.Shell vs Shell() 1

Status
Not open for further replies.

nbateman

MIS
Jun 3, 2003
52
GB

Given:
Dim sh As Object
Set sh = CreateObject("WScript.Shell")
sed = "c:\BIPApps\ssed\ssed s/\x0D//g c:\old.txt > c:\new.txt"

Anybody got any idea why if this works ...
ret = Shell("cmd /c " & sed) ' returns PID

... this doesn't?
ret = sh.Run(sed, 0, True) ' returns 2

Thanks to all,

Nick.




 
And this ?
ret = sh.Run("CMD /C " & sed, 0, True)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks PH as always.

Yes, that works.

Any insight on why "ret = sh.Run(sed, 0, True)" doesn't work? I have it working with other commands.

Nick.
 
You should launch a command interpreter (CMD) for the redirection (> c:\new.txt) to work.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top