"set working_dir =%cd%"是什么意思?

bha*_*_sg 0 batch-file

我是蝙蝠脚本的新手,我正在阅读一个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 .
Run Code Online (Sandbox Code Playgroud)

小智 5

%CD%,我根本没有在你的代码中看到,这意味着当前目录.键入set /?以查看自动变量列表.还解释了字符替换(删除空格).有关语句的if /?更多信息,请参阅if.

代码检查以确保其基目录中没有空格.