我正嘗試創建一個批處理文件,該文件在前面設置目錄的路徑或將其添加到默認路徑的後面。要將目錄置於前面,需要放置/ f或/ F,並將其添加到後面,但不包含/ f或/ F。每次我使用示例目錄時,只要在前面使用/ f或不使用它,就會將它放在前面。請幫我修改。謝謝。路徑批處理文件Windows命令行
@ECHO OFF
ECHO Press Y or y for an explanation on how to use this file.
ECHO Press N or n to continue without help.
REPLY64
:TOP
IF "%1"=="" GOTO DEFAULT
IF NOT "%1"=="" GOTO ADD
IF NOT "%1"=="" GOTO ADD
IF "%1"=="/f" GOTO FRONT
IF "%1"=="/F" GOTO FRONT
IF ERRORLEVEL 121 GOTO F1
IF ERRORLEVEL 110 GOTO TOP
IF ERRORLEVEL 89 GOTO F1
IF ERRORLEVEL 78 GOTO TOP
:F1
ECHO SETPATH /F subdirectory1 subdirectory 2 or SETPATH /f subdirectory1 subdirectory 2.
ECHO The /F or /f tells the batch file to add the subdirectory name in front of the existing path.
ECHO If the command is keyed in without /F or /f, each subdirectory will be added to the end.
GOTO END
:ADD
IF "%1"=="" GOTO END
PATH= %PATH%;%1
SHIFT
GOTO ADD
:FRONT
SHIFT
IF "%1"=="" GOTO END
PATH=%1;%PATH%
GOTO FRONT
:DEFAULT
CALL \MYPATH.BAT
:END
該代碼應將所有目錄放在後面,而不是前面。你可能想檢查一下,並調整你的問題的措辭。 – paxdiablo 2013-05-07 22:13:46