DNS 切换

netsh interface ipv4 set dns name="本地连接" source=static addr=119.29.29.29 register=PRIMARY
netsh interface ipv4 add dns name="本地连接" addr=119.29.29.29
ipconfig /all
pause

netsh interface ipv4 set dns name="本地连接" source=static addr=123.207.137.88 register=PRIMARY
netsh interface ipv4 add dns name="本地连接" addr=101.132.183.99
ipconfig /all
pause

转换大小写

FOR /R %%A IN (.) DO cd %%A && (FOR /F %%B IN ('dir /b /l')  DO rename %%B %%B)

静音

Set ws = CreateObject("WScript.Shell")
ws.SendKeys Chr(&H88AE)
ws.SendKeys Chr(&H88AE)
ws.SendKeys Chr(&H88AE)
ws.SendKeys Chr(&H88AE)
ws.SendKeys Chr(&H88AE)

打开连接

start chrome.exe https://127.0.0.1:8080

粘贴板复制

echo 12345678 |clip

杀进程

taskkill /f /im hostmon.exe

映射盘符

net use H: \\192.168.2.200\_opt\ "123456" /user:"123"  

彩色字函数

rem /*--------- colstr 函数 -------------
:Colstr <attr> <sp> <"str"> <bk> <sp> <enter>
for %%a in (+%2 +%4 +%5 +%6) do (
   if "%%a"=="+" echo 控制参数不能为空&exit/b
   if %%a lss +0 echo 参数越界-&exit/b
   if %%a geq +a echo 参数越界+&exit/b)
if %3 == "" echo 字符串不能为空&exit/b
pushd %tmp%&setlocal ENABLEEXTENSIONS
if exist "%~3?" del/a/q "%~3?">nul 2>nul
if %2 gtr 0 call:%0_bs %2 sp " "&call set/p=%%sp%%<nul
if %4 gtr 0 (call:%0_bs %4 bk "") else set "bk="
call:%0_bs %5 sp " "
set/p=%bk%%sp%<nul>"%~3"&findstr /a:%1 .* "%~3?" 2>nul
if not %6 equ 0 for /l %%a in (1 1 %6)do echo.
endlocal&popd&goto:eof
:Colstr_bs
set "p="&for /l %%a in (1 1 %1)do call set "p=%%p%%%~3"
set "%2=%p%"&goto:eof
rem ------------------------------------*/

使用方法call:colstr 3e 3 "文字" 1 2 2