1 回答

TA貢獻(xiàn)1852條經(jīng)驗(yàn) 獲得超7個(gè)贊
從來(lái)沒有使用:label也沒有:: label-like comment封閉在命令塊內(nèi)部()的括號(hào)。證明:
@ECHO %1>NUL
if "" == "" (
@echo a simple echo, no comments
)
if ""=="" (
@echo a rem comment follows this echo command
rem comment
@echo a rem comment precedes this echo command
)
if ""=="" (
@echo a label-like comment follows this echo command
:: comment
@echo a label-like comment precedes this echo command
)
if ""=="" (
@echo a label follows this echo command
:label
@echo a label precedes this echo command
)
輸出:
==>D:\bat\labels.bat OFF
a simple echo, no comments
a rem comment follows this echo command
a rem comment precedes this echo command
a label-like comment follows this echo command
'@echo' is not recognized as an internal or external command,
operable program or batch file.
a label follows this echo command
'@echo' is not recognized as an internal or external command,
operable program or batch file.
==>
如果我可以理解您的目標(biāo),那么下一個(gè)代碼段應(yīng)該可以按預(yù)期工作:
SETLOCAL enableextensions
rem (set `svnroot_temp` and `choice` variables here)
if /i "%choice%"=="1" (
cls
svn ls %svnroot_temp%
call :top
)
goto :eof
:top
set /p direct=Enter directory:
if /I "%direct%"=="checkout" goto :checkout_area
set "svnroot_temp=%svnroot_temp%\%direct%"
svn ls %svnroot_temp%
goto :top
:checkout_area
請(qǐng)注意,兩個(gè)比較表達(dá)式if /I "%direct%"=="checkout" goto :checkout_area都用雙引號(hào)引起來(lái),因?yàn)槿魏斡脩糨斎攵伎赡馨崭瘢踔量赡転榭铡?/p>
不確定要引用svn ls "%svnroot_temp%"。
不確定命令"%svnroot_temp%"的輸入目錄還是輸出目錄svn ls:
如果輸入:if not exist "%svnroot_temp%\%direct%\" goto :top 在更改之前先檢查使用set "svnroot_temp=%svnroot_temp%\%direct%"
萬(wàn)一輸出:更改MD "%svnroot_temp%" 2>NUL 后使用創(chuàng)建。
- 1 回答
- 0 關(guān)注
- 914 瀏覽
添加回答
舉報(bào)