, XP , Windows.
XP FOR/F: http://www.dostips.com/forum/viewtopic.php?p=9062#p9062. .
, FOR/F IN(). CMD \C command (. Windows (CMD.EXE)?)
, Aacini PROG.BAT.
echo cmdcmdline=%cmdcmdline%
, CMD , /C, XP , Windows.
XP, Vista :
for /f "delims=" %a in ('"test (this)\prog" args') do @echo %a
, FOR (% cmdcmdline%), ( % COMSPEC%):
C:\Windows\system32\cmd.exe /c "test (this)\prog" args
XP CMD , . ( ). Vista , .
HELP CMD
If /C or /K is specified, then the remainder of the command line after
the switch is processed as a command line, where the following logic is
used to process quote (") characters:
1. If all of the following conditions are met, then quote characters
on the command line are preserved:
- no /S switch
- exactly two quote characters
- no special characters between the two quote characters,
where special is one of: &<>()@^|
- there are one or more whitespace characters between the
two quote characters
- the string between the two quote characters is the name
of an executable file.
2. Otherwise, old behavior is to see if the first character is
a quote character and if so, strip the leading character and
remove the last quote character on the command line, preserving
any text after the last quote character.
, CMD 1, , ( ) XP, 2 CMD
test (this)\prog args
, !
- , 1. , MS.
-, Vista , HELP. Vista ( ) 1, , .
2015-05-17: , Vista @, ^ & , . , <, > | , . , Vista 1 where special is one of: &<>@^|.
, , .
XP Vista .
for /f "delims=" %a in ('^""test (this)\prog" args^"') do @echo %a
, ) FOR. , IN(),
C:\Windows\system32\cmd.exe /c ""test (this)\prog" args"
XP, Vista 2, , CMD
"test (this)\prog" args
!
, , .
; ( ) , . , , . "", .
:
var , , .
var "C:\Documents and Settings\myaccount\Desktop\Test_release (x86)\program.exe", .
, "test (this)\prog.exe"
"!var!" , ""test (this)\prog.exe"", . , , - :
" " " "
""!var!"" , """test (this)\prog.exe""", . :
" " " " " "
, :
var , !var! - XP: "! var!"
var , "!var!" Edit-, XP: "! var!" "