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 Run 2

Status
Not open for further replies.

twooly

MIS
Feb 22, 2004
122
US
Not sure why I can't get this to work. Running the output from the wscript.echo line on the command prompt works fine and outputs the text file. But doesn't within the script (doesn't create the text file). I'm pretty sure it has to do with the spaces in the path but since it works with copy and paste I think I have the quotes in the right place. Any ideas?

Thanks in advance.

Code:
Set objShell = WScript.CreateObject("WScript.Shell")
vSystemDrive = GetSystemDrive(".") 
vWWNProgram = "%comspec% /c """ & vSystemDrive & ":\Program Files\SANsurferCLI\scli.exe"" -g>""" & vSystemDrive & ":\Program Files\Tools-Output\WWNoutput.txt"""
wscript.echo vWWNProgram
objShell.Run vWWNProgram, 0, True

It outputs this and I can copy and paste this on the command prompt and this works.
Code:
%comspec% /c "C:\Program Files\SANsurferCLI\scli.exe" -g>"C:\Program Files\Tools-Output\WWNoutput.txt"
 
Going to a different path without the spaces.

Thanks
 
does removing the use of the white space help? i.e. to clarify this is causing you the problems can you try and pipe it location which doesnt have white space?

would wrapping the whole of the command you want comspec to execute in quote help? e.g.

"""C:\Program Files\SANsurferCLI\scli.exe" -g>"C:\Program Files\Tools-Output\WWNoutput.txt"""

not that it shoudl make a difference but for clarity i would have what space between -g > "c:\
 
Going to a path without white space it works as expected.

I also tried putting quotes around the entire entry and that didn't work. Strange.

Thanks for the help.
 
sorry, i havent got SANsurfer or a SAN box to hand so cant test it for you. it should be a case of playing with the quotes though, ugly i know but worst case create a batch file with your redirect command in it which works and call it from your script, ;-) only jesting

as an aside have you looked at fcinfo_%arch%.msi from Microsoft, an interesting bunch of WMI classes to play with which can help with SAN work (will give you the same stuff an SANsurfer though i guess)
 
>"""C:\Program Files\SANsurferCLI\scli.exe" -g>"C:\Program Files\Tools-Output\WWNoutput.txt"""
[tt]"""C:\Program Files\SANsurferCLI\scli.exe"[red]"[/red] -g>[red]"[/red]"C:\Program Files\Tools-Output\WWNoutput.txt"""[/tt]

>I also tried putting quotes around the entire entry and that didn't work.
re-direction with quote should work! So I really doubt this statement.
 
yeah, agree tsuji. thanks for correcting my lack of " in the middle
 
That worked tsuji. Thanks

Mrmovie...fcinfo doesn't work for all hbas. Sansurfer is much much better and gives much more information.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top