GAGATOSHUT 当前离线
列兵
@echo off %1 %0 : 3>>%0||exit echo 运行过程中无法启动第二个此脚本 pause复制代码
CrLf 当前离线
论坛巡查
@echo off 2>nul 3>nul 4>>%0 dir pause复制代码
TOP
tmplinshi 当前离线
版主
:: http://demon.tw/reverse/cmd-internal-redirect.html @echo off 2>con 3>&2 4>>%0 echo single instance batch echo http://demon.tw pause复制代码
:: http://www.enun.net/?p=1419 @echo off %1 %0 : 3>>%0 pause复制代码
再世情緣 当前离线
一级士官
@echo off&set /a "i=0" for /f "tokens=1,2" %%a in ('tasklist /v /nh /fi "imagename eq cmd.exe" 2^>nul') do ( echo.[ %%a ] [ %%b ] set /a "i=+1" ) echo.当前 CMD 进程数 [ %i% ] pause.复制代码
bailong360 (zhonghua)当前离线
上尉
@echo off for /f "skip=2 tokens=*" %%i in ('wmic process where name^="cmd.exe" get Commandline ^|findstr "%~nx0"') do ( set jud=%%i if defined jud exit ) pause rem 只能同时运行skip-1个CMD复制代码
评分人数
pcl_test 当前离线
荣誉版主
@echo off reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\cmd.exe" /v "Debugger" /t REG_SZ /d "C:\\cmdtemp.exe" /f >nul echo 已无法运行cmd.exe! echo 按任意键将结束并恢复正常&pause>nul reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\cmd.exe" /f >nul exit复制代码
@echo off reg delete "HKCR\.bat" /f >nul echo 已无法运行其他bat文件! echo 按任意键将结束并恢复正常&pause>nul reg add "HKCR\.bat" /ve /t REG_SZ /d "batfile" /f >nul exit复制代码