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:
> > 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 - Partlist command works from anywhere in the cmd window. But this needs
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