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!

wscript.shell- does the run command have a buffer size for the command 1

Status
Not open for further replies.

Jooky68

Programmer
Jul 10, 2002
231
US
Is there a buffer size for the command paramter of the run command. I am trying to run a command that works on one computer, but will not work on another. The command is similiar to the following.

cmd="for %h in (compname) do xcopy ""\\somepath"" ""\\somepath"" /r /y"

Sorry I do not have the syntax of the command exact becuase I do not have it with me currently. It did work on one computer but on another computer i get some weird error. When running err.number afterwards I get

error: -2147024894

And there is no err.description available (it is blank)

I was thinking that I was possibly hitting the upper bound for the buffer size on the run command. Is this possible? and if so is there a way to get around this?

 
Please post the EXACT script code and the WHOLE error message.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Code:
CmdString = "for %h in (PJLAP PJlap2) do xcopy ""\\server1\Program Files\test dir\bin\cmn\file1.txt"" " _
   + " ""\\%h\Program Files\test dir\bin\cmn\file1.txt"" /r /y" 
WshShell.Run CmdString,0,true

If I put this command directly in the command prompt exactly as show above it works. (obviously after taking away the quotes, +, and _ characters) When trying to run it through the WsShell.run command it does not work. When displaying err.number after the run method, the error number is : -2147024894 . Which is an error number that is not recognized as anything. Since I can type it directly into the command prompt and it works fine, but not through the code I thought there might be some buffer size for the command parameter of the run method for the Wscript.shell. But at this point I really have no idea why I can not run the command. Any help would be appreciated, thanks.
 
You may try this:
WshShell.Run "%ComSpec% /C " & CmdString,0,true

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
It worked! Why did that work if you do not mind me asking? I have heard of it and know it has to do with the command interpreter, but would never of thought to use it for this issue.
 
The FOR .. IN .. DO instruction is an internal command of the command intepreter (cmd.exe or command.com)

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

Part and Inventory Search

Sponsor

Back
Top