Re: Executing secondary command in shell.run
- From: "Han" <hp4444@xxxxxxxxxxxxxxxx>
- Date: Tue, 17 Feb 2009 11:20:22 +0900
Thanks Al Dunbar
Exactly. Representation instead of suppress.
Anyway. Your recommandation was my first try without success.
strCmd1 = """C:\program files\windows azure sdk\v1.0\bin\setenv.cmd"""
works as expected. But,
strCmd2 = """cspack AAA BBB\CCC.XXX"""
doesn't work with error message,
"c:\Program is neither executable file nor batch file ..."
The second command with double double quotation marks definitely affects the first commands here. I have no idea why they are related when the second has double double quotation marks.
On the other hand, when the second has no double double quotations error message is,
"no file named c:\BBB\CCC.XXX ..."
Which wrongly suppress the "AAA " part. I worry that can be caused from the program "cspack.exe", which is the worst case.
"Al Dunbar" <alandrub@xxxxxxxxxxx> 님이 다음 메시지를 작성했습니다. news:%23MRszTDkJHA.5124@xxxxxxxxxxxxxxxxxxxxxxx
"Han" <hp4444@xxxxxxxxxxxxxxxx> wrote in message news:59D45276-1399-40F9-8B0F-651B6E7F4B36@xxxxxxxxxxxxxxxxHello again
I think I am nearly at there except miner issue.
Set oShell = WScript.CreateObject ("WScript.shell")
strCmd1 = """C:\program files\windows azure sdk\v1.0\bin\setenv.cmd"""
strCmd2 = "cspack AAA.XXX"
strCmd3 = "pause"
oShell.Run "%comspec% /k" & _
strCmd1 & " && " & _
"cd .. && " & _
"cd .. && " & _
"cd .. && " & _
"cd .. && " & _
strCmd2 & " && " & _
strCmd3, 1, true
Above script works fine when I do "AAA.XXX". Works either with "AAA\BBB.XXX".
But doesn't work with "AAA BBB\CCC.XXX". i.e., when one of directoris has space.
How do you supress the spaces in such a situation? I tried everything I can imagine: every kind of single or double quotations.
You don't want to suppress the spaces because they are there in the path to the file in question. What you want to do is to represent them. You have already done that for the batch file, whose location you give as:
strCmd1 = """C:\program files\windows azure sdk\v1.0\bin\setenv.cmd"""
In a quoted literal string you represent a literal double quote character by including two double quote characters. Perhaps all you need do is to change this:
strCmd2 = "cspack AAA.XXX"
to this:
strCmd2 = """cspack AAA.XXX"""
/Al
"Han" <hp4444@xxxxxxxxxxxxxxxx> 님이 다음 메시지를 작성했습니다. news:14E4F8BF-6E79-4A9E-AE02-65E84D0CBDBC@xxxxxxxxxxxxxxxxHello
I want to run some commands consecutively with shell. See below,
set shell=createObject("wscript.shell")
set fso=createobject("scripting.filesystemobject")
set f=fso.createTextfile("c:\put.txt", true)
with f
.writeline "dir"
end with
shell.run "%comspec% /k ""C:\program files\windows azure sdk\v1.0\bin\setenv.cmd"" -s:c:\put.txt", 1, true
f.close
How do you run the second command "dir" here? Currently the first command setenv.cmd runs well. In real world scenario I will add some more commands after the "dir".
Thanks
.
- Follow-Ups:
- Re: Executing secondary command in shell.run
- From: Paul Randall
- Re: Executing secondary command in shell.run
- References:
- Executing secondary command in shell.run
- From: Han
- Re: Executing secondary command in shell.run
- From: Han
- Re: Executing secondary command in shell.run
- From: Al Dunbar
- Executing secondary command in shell.run
- Prev by Date: Dizzy Gillespie Watch, Best Wristwatch
- Next by Date: Re: Executing secondary command in shell.run
- Previous by thread: Re: Executing secondary command in shell.run
- Next by thread: Re: Executing secondary command in shell.run
- Index(es):
Relevant Pages
|