@echo off
PUSHD %~dp0
Set findfile=12345.exe
Set renfname=45678.exe
Set DelATTR=ATTRIB -S -H -R
For %%I In (C D E F G H I G K L M N O P Q R S T U V W ) Do If Exist "%%I:\%findfile%" (
%DelATTR% "%%I:\%findfile%"
Ren "%%I:\%findfile%" %renfname%
)
Exit
保存为BAT运行,在WinPE下不能用:
@echo off&setlocal enabledelayedexpansion
for /f "skip=1" %%a in ('wmic logicaldisk get deviceid') do (
set drv=%%a
set drv=!drv:~,2!
if exist "!drv!\12345.exe" ren "!drv!\12345.exe" "45678.exe"
)