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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

WshShell.Run and command switches

Status
Not open for further replies.
Oct 27, 2004
32
US
Hi there. I'm sure that I'm just missing something simple here, but I can't get this command to apply the switches :(
The command works because it pops up a shell windows, however I know it's not applying the switches because /q means Quiet no confirmation.

WshShell.Run ("%comspec% /C C:\Test\DelProf.exe /q /i /d:28 /C:\\%ComputerName%")

I've looked around the forum and tried a few of the similar posts but no dice.

The evialent DOS command is this;
C:\Test\DelProf.exe /q /i /d:28 /C:\\%ComputerName%
 
Have you tried this ?
WshShell.Run "C:\Test\DelProf.exe /q /i /d:28 /C:\\%ComputerName%"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
I have tried that and it still asks for user input :(
I could always call a DOS Batch file but that seems like a step backwards.

Anymore thoughts?

Jay
 
Hello HelpJayPlz,

The %computername% meant to be your local m/c? otherwise, expand it instead?
[tt]
WshShell.Run "C:\Test\DelProf.exe /q /i /C:\\HFD00126 /d:28"
[/tt]
regards - tsuji
 
Nope still no joy :( It's like it doesn't process the command after the .exe
I've run the command without any switches and get the same result (WshShell.Run "C:\Test\DelProf.exe")
 
HelpJayPlz,

I would re-install wsh5.6 on top again.

- tsuji
 
I re-installed WSH5.6 and still doesn't work :( so I've created a DOS Batch file with the exact same command in it and changed the VBS to execute the DOS batch, that works
~8( ???? It's a work around I know. Delprof.exe deletes users locally cached profiles from local hard disk, I run this at either startup or shutdown as house keeping. It's a microsoft program, and a free download.

If you have any other idea's as to why wsh won't process the command switches then please let me know.

- Jay
 
HelpJayPlz,

Host the .vbs with cscript see what you get. (It can be made as default open or an option in the context-menu.)
[tt]
cscript.exe //b //nologo yourscript.vbs
[/tt]
- tsuji
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top