avatar

批处理的应用

并判断Window后台是否已运行某个程序,有就跳过,没有就快速启动指定程序(打开文件夹时,若该文件夹已打开,会使文件夹展现到最上面);可以在一个文件中复制多次,实现一次性打开多个程序

1
2
3
4
5
6
7
8
9
10
11
12
@echo off
:check
:: ""中间写要判断的运行中的程序
tasklist|find /i "飞秋.exe"
if errorlevel 1 goto 1
if errorlevel 0 goto 0
:0
goto exit
:1
:: start (空格)后面跟程序启动文件的绝对路径,可以在快捷图标中获取,也可以按照自己的想法打开文件夹或启动某个无快捷图标的程序
call start E:\develop\飞秋.exe
:exit

桌面白图标修复

1
2
3
4
5
6
@echo off
taskkill /f /im explorer.exe
CD /d %userprofile%\AppData\Local
DEL IconCache.db /a
start explorer.exe
echo 执行完成

管理员身份运行批处理文件

1
2
3
4
5
6
7
8
9
10
11
12
@echo off
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
if '%errorlevel%' NEQ '0' (
goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
exit /B
:gotAdmin
if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )

数码雨

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
@echo off&setlocal enabledelayedexpansion&color 02&mode con lines=30&title 黑客帝国数码雨
setlocal&set flag=0
:loop
if %flag% lss 30 (set/a flag+=1) else (call :chang)
for /l %%i in (1,1,26) do (
if defined a%%i (set/a a%%i=!random!%%2&set tmp=!a%%i!
) else (if !random! lss 1000 (set/a a%%i=!random!%%2&set tmp=!a%%i!
) else (set tmp= ))
call set line%flag%=%%line!flag!%% !tmp!
)
cls&for /l %%i in (%flag%,-1,1) do echo.!line%%i!
for /l %%i in (1,1,100) do ver>nul
::ping /n 1 127.1>nul
if !random! lss 500 (endlocal&setlocal&set flag=0)
goto :loop

:chang
for /l %%i in (1,1,29) do (
set /a tmp=%%i+1
call set line%%i=%%line!tmp!%%
)
set line%flag%=
文章作者: 123
文章链接: https://gao5805123.github.io/123/2020/05/03/%E6%89%B9%E5%A4%84%E7%90%86%E7%9A%84%E5%BA%94%E7%94%A8/
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 123
打赏
  • 微信
    微信
  • 支付宝
    支付宝