I am trying to get current directory, but for some reasons I can't recieve it.
我想获取当前目录,但由于某些原因我无法收到它。
for /f %%i in ('cd') do ( set log=%%i )
for / f %% i in('cd')do(set log = %% i)
set log=%cd%
I am trying these but nothing. Could you explain what I am doing wrong?
我正在尝试这些,但没有。你能解释一下我做错了什么吗?
1 个解决方案
#1
1
@ECHO OFF
SETLOCAL
for /f %%i in ('cd') do ( set log=%%i &ECHO %%i)
ECHO log is %log%
set log=%cd%
ECHO now log is %log%
GOTO :EOF
Seems to work perfectly well for me. What do you mean by I can't recieve it.
?
似乎对我来说非常好。你是什么意思我无法接受它。 ?
#1
1
@ECHO OFF
SETLOCAL
for /f %%i in ('cd') do ( set log=%%i &ECHO %%i)
ECHO log is %log%
set log=%cd%
ECHO now log is %log%
GOTO :EOF
Seems to work perfectly well for me. What do you mean by I can't recieve it.
?
似乎对我来说非常好。你是什么意思我无法接受它。 ?