我是蝙蝠脚本的新手,我正在阅读一个bat文件来设置eclipse的环境,我看到以下内容并没有理解代码。有人可以评论代码并帮助我。
:::::::: 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 .
答案 0 :(得分:5)
%CD%
,我根本不在您的代码中看到,表示当前目录。输入set /?
以查看自动变量列表。还解释了字符替换(删除空格)。有关if /?
声明的更多信息,请参阅if
。
代码检查以确保其基目录中没有空格。