代码如下
@echo on &pushd %~dp0
setlocal enabledelayedexpansion
for /f "eol=# skip=1 delims=; tokens=1,2" %%i in (config.txt) do (
for %%A in ("%%i") do set attribs=%%~aA
if "%attribs:~8,-2%" == "l" echo This is a symlink/junction
)
你原来的代码想改对的话:
setlocal enabledelayedexpansion
for /f "eol=# delims=; tokens=1,2" %%i in (config.txt) do (
for %%A in ("%%i") do (
set attribs=%%~aA
if "!attribs:~8,-2!" == "l" (
echo "%%i" is a symlink/junction
) else (
echo "%%i" is not a symlink/junction
)
)
)