@echo off
SET Var0=%0
IF '^%Var0:~0,1%'=='^"' SET Var0=%Var0:~1,-1%
FOR /f "delims=" %%I in ("%Var0%") do Set TP=%%~dpI
SET TP=%TP:~0,-1%\
for /f "tokens=1,2 delims=:" %%i in ("%TP%") do set drive=%%i:
%drive%
for /f "tokens=1,2 delims=:" %%i in ("%TP%") do set directory=%%j
cd %directory%
@echo off
SET Var0=%0
IF '^%Var0:~0,1%'=='^"' SET Var0=%Var0:~1,-1%
FOR /f "delims=" %%I in ("%Var0%") do Set TP=%%~dpI
SET TP=%TP:~0,-1%\
for /f "tokens=1,2 delims=:" %%i in ("%TP%") do set drive=%%i:
%drive%
for /f "tokens=1,2 delims=:" %%i in ("%TP%") do set directory=%%j
cd %directory%
@echo off
SET Var0=%0
IF '^%Var0:~0,1%'=='^"' SET Var0=%Var0:~1,-1%
FOR /f "delims=" %%I in ("%Var0%") do Set TP=%%~dpI
SET TP=%TP:~0,-1%\
REM 上列4行的写法 "不论资料夹是否含空格" 皆适用
for /f "tokens=1,2 delims=:" %%i in ("%TP%") do set drive=%%i:
%drive%
for /f "tokens=1,2 delims=:" %%i in ("%TP%") do set directory=%%j
cd %directory%
REM 上列4行的写法在Windows以系统管理员身份执行时,可自 %WinDir%\sys????? 回到程式本身的正确位置
@echo off
SET Var0=%0
IF '^%Var0:~0,1%'=='^"' SET Var0=%Var0:~1,-1%
FOR /f "delims=" %%I in ("%Var0%") do Set TP=%%~dpI
SET TP=%TP:~0,-1%\
REM 上列4行的写法 "不论资料夹是否含空格" 皆适用
for /f "tokens=1,2 delims=:" %%i in ("%TP%") do set drive=%%i:
%drive%
for /f "tokens=1,2 delims=:" %%i in ("%TP%") do set directory=%%j
cd %directory%
REM 上列4行的写法在Windows以系统管理员身份执行时,可自 %WinDir%\sys????? 回到程式本身的正确位置
@echo off
SET Var0=%0
IF '^%Var0:~0,1%'=='^"' SET Var0=%Var0:~1,-1%
FOR /f "delims=" %%I in ("%Var0%") do Set TP=%%~dpI
SET TP=%TP:~0,-1%\
REM 上列4行的写法 "不论资料夹是否含空格" 皆适用
for /f
详情回复
发表于 2017-9-16 19:17
@echo off
SET Var0=%0
IF '^%Var0:~0,1%'=='^"' SET Var0=%Var0:~1,-1%
FOR /f "delims=" %%I in ("%Var0%") do Set TP=%%~dpI
SET TP=%TP:~0,-1%\
REM 上列4行的写法 "不论文件夹是否含空格" 皆适用
for /f "tokens=1,2 delims=:" %%i in ("%TP%") do set drive=%%i:
%drive%
for /f "tokens=1,2 delims=:" %%i in ("%TP%") do set directory=%%j
cd %directory%
REM 上列4行的写法在Windows以系统管理员身份执行时,可自 %WinDir%\sys????? 回到程式本身的正确位置