本帖最后由 sairen139 于 2020-6-29 18:10 编辑
@echo off setlocal enabledelayedexpansion rem 假设原来的盘符是C set oldDrive=C:\ rem 假设新的盘符是D set newDrive=D:\
for %%a in (*.lnk) do (
for /f "tokens=2 delims==" %%h in ('shortcut /f:"%%a" /a:q ^| findstr "TargetPath="') do ( set target=%%h ) for /f "tokens=2 delims==" %%h in ('shortcut /f:"%%a" /a:q ^| findstr "WorkingDirectory="') do ( set working=%%h ) set target=!target:%oldDrive%=%newDrive%! set working=!working:%oldDrive%=%newDrive%! shortcut /f:"%%a" /a:e /t:"!target!" /w:"!working!" )
shortcut.exe下载地址:
http://www.bathome.net/thread-4020-1-1.html
这个只改根目录,不改子目录下的lnk快捷方式。
|