我正尝试创建一个批处理文件,该文件在前面设置目录的路径或将其添加到默认路径的后面。要将目录置于前面,需要放置/ 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