本帖最后由 binghejin 于 2020-6-28 17:39 编辑
以下为修改盘符并生成一个新的文件。- @echo off
- cls
- for /f "tokens=1 delims=\" %%a in ('echo %cd%') do (set pan=%%a)
- for /f "delims=" %%z in (config.pro) do (
- for /f "tokens=1 delims= " %%a in ('echo %%z') do (
- for /f "tokens=2 delims=:" %%b in ('echo %%z') do (
- echo %%a %pan%%%b>>new.txt
- )
- )
- )
复制代码 以下为在源文件上修改盘符(注意保存原文件)- @echo off
- cls
- for /f "tokens=1 delims=\" %%a in ('echo %cd%') do (set pan=%%a)
- for /f "delims=" %%z in (config.pro) do (
- for /f "tokens=1 delims= " %%a in ('echo %%z') do (
- for /f "tokens=2 delims=:" %%b in ('echo %%z') do (
- echo %%a %pan%%%b>>new.txt
- )
- )
- )
- del /q config.pro>nul
- ren new.txt config.pro
复制代码
|