2016-03-09 82 views
0

我是新來的蝙蝠腳本,我正在閱讀bat文件來設置eclipse的環境,我看到下面的內容,而不是理解代碼。有人可以評論該代碼並幫助我。「set working_dir =%cd%」是什麼意思?

:::::::: Check if the our working directory contains spaces 
set working_dir_no_spaces=%working_dir% 
set working_dir_no_spaces=%working_dir_no_spaces: =% 

:::::::: If we've got a space, then quit here. 
if not "%working_dir_no_spaces%"=="%working_dir%" (
    echo ------------------------------------------------------------ 
    echo Your directory path contains a space. 
    echo Try putting this package without a space in the path 
    echo ------------------------------------------------------------ 
    echo Recommended location is your C drive itself 
    echo Common mistake is when people put this at their desktop 
    echo and unfortunately their name has a space :(
    echo ------------------------------------------------------------ 
    echo Pressing any key will exit this process. 
    echo ------------------------------------------------------------ 
    pause 
    exit 
) 

:::::::: JAVA 
set PATH=%working_dir%\toolchain\jre\bin;%PATH%; 

:::::::: Toolchain 
set PATH=%working_dir%\toolchain\bin;%PATH% 
set PATH=%working_dir%\binutils;%PATH% 

:::::::: Doxygen & Graphviz 
set PATH=%working_dir%\doxygen\doxygen\bin;%PATH% 
set PATH=%working_dir%\doxygen\graphviz\bin;%PATH% 

:::::::: Python 
set PATH=%working_dir%\python-3.5.0-embed-win32;%PATH% 

:::::::: echo %PATH% 
start eclipse32\eclipse.exe -clean -data projects 
:: start cd . 

回答

5

%CD%,我根本看不到你的代碼,意思是當前目錄。輸入set /?查看自動變量列表。字符替換也被解釋(刪除空格)。有關if聲明的更多信息,請參見if /?

代碼檢查以確保其基本目錄中沒有空格。