来自远方 - batch
type: channel
link: https://runyf.cn/category/batch/
items: windows系统分辨率固定1080p
items: 使用bat批处理语言实时ping监控主机
items: bat批处理语言转exe
items: 使用bat批处理快速切换网卡配置脚本
items: 序号命名BAT

windows系统分辨率固定1080p
type: item
date: 2023-10-09T20:16:00+08:00
description: bat代码需要用到nircmd工具，并且加入环境变量if "%1"=="hide" goto CmdBegin start mshta vbscript:createobject("wscript.shell").run("""%~0"" hide",0)(window.close)&&exit :CmdBegin :main wmic path Win32_VideoController get VideoModeDescription | find "1920 x 1080" || nircmd.exe setdisplay 1920 1080 32 timeout /t 3 goto main

使用bat批处理语言实时ping监控主机
type: item
date: 2022-08-15T16:55:00+08:00
description: 新版icmp监控@echo off set ip=192.168.6.156 set waits=1 set log=log_icmPing.txt :main echo %date% %time% >> %log% ping -n 1 %ip% | findstr /i "来自 一般 超时 失败">>%log% timeout /t %waits% goto main主机tcp端口监控@echo off set ip=192.168.6.156 set port=3389 set waits=1 set log=log_portPing.txt :main echo %date% %time% >> %log% tcping -n 1 %ip% %port% | find "Probing" >> %log% timeout /t %waits% goto main旧版本icmp监控@echo off @title 主机监控 :: by: www.runyf.cn :: 等待用户输入需要监控IP set /p ip=请输入IP地址: :: 请求等待秒数 set waits=1 :: 删除缓存 del *.iptmp :: 设置回显时间格式 set file=%ip%-%date:~0,4%%date:~5,2%%date:~8,2%.txt set echotime=%date:~0,4%%date:~5,2%%date:~8,2% %time% echo %echotime% 目标地址：%ip% 脚本开始执行... echo %echotime% 目标地址：%ip% 脚本开始执行... >> %file% :start @title 主机监控 %ip% :: 设置文件名 set file=%ip%-%date:~0,4%%date:~5,2%%date:~8,2%.txt set tmpfile=%file%.iptmp :: 更新时间 set echotime=%date:~0,4%%date:~5,2%%date:~8,2% %time% :: 进行ping测试 echo|set /p =%echotime% >%tmpfile% ping -n 1 %ip% | findstr /i "来自 一般 超时">>%tmpfile% :: 回显 findstr 2 %tmpfile%>>%file% findstr 2 %tmpfile% :: 等待 timeout /t %waits% > nul goto start

bat批处理语言转exe
type: item
date: 2021-12-13T15:59:50+08:00
description: Bat to Exehttps://www.battoexe.com/

使用bat批处理快速切换网卡配置脚本
type: item
date: 2021-11-22T11:59:00+08:00
description: 运行展示脚本源代码展示:: www.runyf.cn @title 网卡配置修改 by 远方 @echo off :: 可将配置修改成你的网卡名，也可以将网卡名改成eth0 set nic="WLAN" set ping=runyf.cn set count=20 echo 一键修改网卡配置脚本 当前网卡 %nic% echo. echo 1:自动获取 DHCP 2:手动配置 Manual echo 3:配置解析 DNS 4:配置面板 网络连接 echo 5:192.168.0.1/24 6:192.168.1.1/24 echo. set /p choice=请选择设置类型: echo. if "%choice%"=="1" goto ip1 if "%choice%"=="2" goto ip2 if "%choice%"=="3" goto ip3 if "%choice%"=="4" goto ip4 if "%choice%"=="5" goto ip5 if "%choice%"=="6" goto ip6 :ip1 echo 自动获取IP地址.... netsh interface ip set address name = %nic% source = dhcp echo 自动获取DNS服务器.... netsh interface ip set dns name = %nic% source = dhcp echo 设置完成 echo 进行连通性测试 ping -n %count% %ping% exit :ip2 :: 配置信息 set /p addr=请输入IP地址: set /p automask=请输入网络标识位: set /p gateway=请输入网关（回车不设置）: if %automask% == 8 ( set mask=255.0.0.0 ) else if %automask% == 9 ( set mask=255.128.0.0 ) else if %automask% == 10 ( set mask=255.192.0.0 ) else if %automask% == 11 ( set mask=255.224.0.0 ) else if %automask% == 12 ( set mask=255.240.0.0 ) else if %automask% == 13 ( set mask=255.248.0.0 ) else if %automask% == 14 ( set mask=255.252.0.0 ) else if %automask% == 15 ( set mask=255.254.0.0 ) else if %automask% == 16 ( set mask=255.255.0.0 ) else if %automask% == 17 ( set mask=255.255.128.0 ) else if %automask% == 18 ( set mask=255.255.192.0 ) else if %automask% == 19 ( set mask=255.255.224.0 ) else if %automask% == 20 ( set mask=255.255.240.0 ) else if %automask% == 21 ( set mask=255.255.248.0 ) else if %automask% == 22 ( set mask=255.255.252.0 ) else if %automask% == 23 ( set mask=255.255.254.0 ) else if %automask% == 24 ( set mask=255.255.255.0 ) else if %automask% == 25 ( set mask=255.255.255.128 ) else if %automask% == 26 ( set mask=255.255.255.192 ) else if %automask% == 27 ( set mask=255.255.255.224 ) else if %automask% == 28 ( set mask=255.255.255.240 ) else if %automask% == 29 ( set mask=255.255.255.248 ) else if %automask% == 30 ( set mask=255.255.255.252 ) else if %automask% == 31 ( set mask=255.255.255.254 ) els…

序号命名BAT
type: item
date: 2021-08-07T01:08:00+08:00
description: 注意编码@echo off setlocal enabledelayedexpansion ::打开系统延时 set /a b=0 dir /b/od ::按时间顺序显示当前文件夹下的所有文件名 pause ::给你反悔时间 for /f "delims=" %%f in ('dir /b/od *.*') do ( if not "%%f"=="%~nx0" ( set /a b+=1 ren "%%f" "!b!%%~xf" echo. !b!%%~xf ) ) pause