开发者

Replace all autocad shortcuts found on system ussing Batch?

I need to replace every icon (AutoCAD 2010.LNK) found on the compu开发者_高级运维ter with another .LNK using batch.

The icon\ shortcut as we well know can be found anywhere and as many times as the user likes.

How can I achieve this?


first, read HELP FOR

and then try this in a command line

  FOR /F "tokens=*" %a in ('dir /B /S "AUTOCAD 2010.LNK"') do ECHO COPY new.lnk %a

experiment with from various locations and test carefully

then create a bat file with the following contents. Note the change of %a into %%a and the removal of the 'echo'

@echo off
PUSHD C:\
FOR /F "tokens=*" %%a in ('dir /B /S "AUTOCAD 2010.LNK"') do COPY new.lnk %%a
POPD


@ECHO OFF
SET "linklist=%USERPROFILE%\linklist.txt"
SET "replacement=D:\path\to\replacement.lnk"
ECHO Searching...
DIR /B /S "C:\AutoCAD 2010.LNK" >%linklist%
DIR /B /S "D:\AutoCAD 2010.LNK" >>%linklist%
:: add similar rows for every drive letter you want to be included
ECHO Replacing...
FOR /F "tokens=*" %%f IN (%linklist%) DO COPY %replacement% %%f
ECHO Finished.

A couple of notes:

  • Your replacement shortcut file must be named differently (like AutoCAD 2010.LNK.new, for example).

  • In Windows Vista/7 you will probably be prohibited from overwriting files in certain folders unless you are running the script with elevated rights.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜