如下的一个要求:
用户要求输入一个路径,batch程序读取该路径,并与batch中定义的相对路径进行拼接,这样可能会遇到如下的问题:
@echo off
set log=\err.log
set /p installoc=please input the path of utility installation location:
pushd %installoc% 2>nul
popd
set a_path=%installoc%%log%
echo The path of log file is %a_path%
如果用户输入 c:\utility\,
则 a_path 为 c:\utility\\err.log, 请注意这里会有两个 \\, 如何规则这个绝对路径,输出为 c:\utility\err.log,
谢谢,学习中....
用户要求输入一个路径,batch程序读取该路径,并与batch中定义的相对路径进行拼接,这样可能会遇到如下的问题:
@echo off
set log=\err.log
set /p installoc=please input the path of utility installation location:
pushd %installoc% 2>nul
popd
set a_path=%installoc%%log%
echo The path of log file is %a_path%
如果用户输入 c:\utility\,
则 a_path 为 c:\utility\\err.log, 请注意这里会有两个 \\, 如何规则这个绝对路径,输出为 c:\utility\err.log,
谢谢,学习中....
