![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| Guest | run 2 dos commands using vbScript as a single command Hi, I am trying to change the directory and then run another command all in 1 line. But for some strange reason I can't even get the first command to work. I need help!! SA Here's the code =========== dim objShell dim inFile, outFile, projFile,folderC ,cmd1,cmd2 'setting variuos paths folderC ="C:\temp\Projects\21038Ax1aDx" inFile = "C:\Documents and Settings\smitha\My Documents\BOM \partlist.ini" outFile = "out.lst" projFile = "10297200" '2 commands cmd1= "cd folderC" cmd2="partlist projFile -input inFile -outFile outFile" set objshell = createobject("Wscript.shell") objshell.Run "%compsec% /k cmd1 & cmd2" |
My System Specs![]() |
| | #2 (permalink) |
| Guest | Re: run 2 dos commands using vbScript as a single command <karsagarwal@xxxxxx> wrote in message news:f32b7bf8-f730-416d-82d6-9064066febff@xxxxxx Quote: > Hi, > I am trying to change the directory and then run another command all > in 1 line. But for some strange reason I can't even get the first > command to work. I need help!! > > SA > > > Here's the code > =========== > dim objShell > dim inFile, outFile, projFile,folderC ,cmd1,cmd2 > > 'setting variuos paths > folderC ="C:\temp\Projects\21038Ax1aDx" > inFile = "C:\Documents and Settings\smitha\My Documents\BOM > \partlist.ini" > outFile = "out.lst" > projFile = "10297200" > > '2 commands > cmd1= "cd folderC" > cmd2="partlist projFile -input inFile -outFile outFile" > > set objshell = createobject("Wscript.shell") > objshell.Run "%compsec% /k cmd1 & cmd2" objshell.Run "%compsec% /k cmd1 & cmd2" with this line: wscript.echo "%compsec% /k cmd1 & cmd2" and you will immediately see that the command cannot possibly run, because "cd folderC" gets lumped together with "partlist". You probably have a second problem too. Where is the command processor supposed to find "partlist"? In the current folder? What is the current folder? In scripts you MUST state the drive, folder, file name and extension! |
My System Specs![]() |
| | #3 (permalink) |
| Guest | Re: run 2 dos commands using vbScript as a single command On Sep 5, 10:28*am, "Pegasus \(MVP\)" <I....@xxxxxx> wrote: Quote: > <karsagar...@xxxxxx> wrote in message > > news:f32b7bf8-f730-416d-82d6-9064066febff@xxxxxx > > > > > Quote: > > Hi, > > I am trying to change the directory and then run another command all > > in 1 line. But for some strange reason I can't even get the first > > command to work. I need help!! Quote: > > SA Quote: > > Here's the code > > =========== > > dim objShell > > dim inFile, outFile, projFile,folderC ,cmd1,cmd2 Quote: > > 'setting variuos paths > > folderC ="C:\temp\Projects\21038Ax1aDx" > > inFile = "C:\Documents and Settings\smitha\My Documents\BOM > > \partlist.ini" > > outFile = "out.lst" > > projFile = "10297200" Quote: > > '2 commands > > cmd1= "cd folderC" > > cmd2="partlist *projFile -input inFile -outFile outFile" Quote: > > set objshell = createobject("Wscript.shell") > > objshell.Run "%compsec% /k cmd1 & cmd2" > Replace the line > objshell.Run "%compsec% /k cmd1 & cmd2" *with this line: > wscript.echo "%compsec% /k cmd1 & cmd2" > > and you will immediately see that the command cannot possibly run, because > "cd folderC" gets lumped together with "partlist". > > You probably have a second problem too. Where is the command processor > supposed to find "partlist"? In the current folder? What is the current > folder? In scripts you MUST state the drive, folder, file name and > extension!- Hide quoted text - > > - Show quoted text - to be in the directory just for the -input attribute to work correctly as it is a custom program. I tested this exact command in the cmd window with "&" and it works fine. I am perplexed as to how to solve this problem. SA |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| I need to Call this command in a vbscript | VB Script | |||
| Output XML to Single Line Log File using VBScript | VB Script | |||
| Powershell Wrapper Script Problems - Trying to Call PowershellExchange 2007 Commands from Secondary Language (Like VBScript) | PowerShell | |||
| Equivalent of powershell to vbscript command | PowerShell | |||
| Where is the help for command line commands? | Vista General | |||