回复 10# hlzj88
exe只用一个,只有重命名成功的那个bat会执行操作,操作后会改回原名。然后循环下去。
set 随机数是疏忽了,以前听大佬说,大概是相同时间(可能以秒算),确实会产生相同的随机数,
那就放loop外面,打开bat时间隔1秒,确保3次的随机数不同。
- @echo off
- set str=%random%%random%%random%
- :loop
- if exist "d:\htox32c.exe" (
- ren "d:\htox32c.exe" "htox32c%str%.exe" 2>nul
- )
- if exist "d:\htox32c%str%.exe" (
- "d:\htox32c%str%.exe" /IP /O0 /U1+4 2.html
- ) else (
- timeout 1 >nul
- goto :loop
- )
- ren "d:\htox32c%str%.exe" "htox32c.exe"
复制代码
或者用一个bat带参数执行自身。
- @echo off
- %1 (for %%a in (1 2 3) do (start "" "%~f0" rem %%a))&exit
-
- if "%~2" equ "1" (
- pushd "d:\test1"
- ) else if "%~2" equ "2" (
- pushd "d:\test2"
- ) else if "%~2" equ "3" (
- pushd "d:\test3"
- ) else goto:eof
-
- set str=%~2
-
- :loop
- if exist "d:\htox32c.exe" (
- ren "d:\htox32c.exe" "htox32c%str%.exe" 2>nul
- )
- if exist "d:\htox32c%str%.exe" (
- "d:\htox32c%str%.exe" /IP /O0 /U1+4 2.html
- ) else (
- timeout 1 >nul
- goto :loop
- )
- ren "d:\htox32c%str%.exe" "htox32c.exe"
复制代码
|