批处理脚本集合

一、 网卡信息查询

@echo off

::hostname

for  /f   %%i in ('curl  -s ifconfig.io')  do  ( set wanip=%%i )

for /f "tokens=1,2,3 delims=={,}" %%a in ('wmic NICCONFIG where "IPEnabled='TRUE'" get DefaultIPGateway^,DNSServerSearchOrder^,IPAddress^,IPSubnet /value^|findstr "={"') do (
	if "%%a"=="DefaultIPGateway" (set "Gate=%%~b"
	) else if "%%a"=="DNSServerSearchOrder" (set "DSN1=%%~b"&set "DSN2=%%~c"
	) else if "%%a"=="IPAddress" (set "IP=%%~b"
	) else if "%%a"=="IPSubnet" (set "Mask=%%~b")
	if defined Gate if defined Mask goto :show	
)

:show
	echo; 计算名: %USERDOMAIN%
	echo; 本机内网IP: %IP%
	echo;子网掩码:	%Mask%
	echo;默认网关:	%Gate%
	echo;首选 DNS:	%DSN1%
	echo;备用 DNS:	%DSN2%
    echo;公网出口IP: %wanip%
                  
pause

执行结果如下:
在这里插入图片描述

二 、修改DNS

创建文件 dns.bat

@echo off
chcp 65001
netsh interface ip set dnsservers "以太网" static 114.114.114.114 primary
netsh interface ip add dnsservers "以太网" 8.8.8.8 index=2 
ipconfig /flushdns

右键-以管理员身份运行即可,以太网改为你的网络名称
关闭360杀毒软件

三、多开微信

@echo off

start "" "C:\Program Files (x86)\Tencent\WeChat\WeChat.exe"

start "" "C:\Program Files (x86)\Tencent\WeChat\WeChat.exe"

start "" "C:\Program Files (x86)\Tencent\WeChat\WeChat.exe"


exit

四、关闭程序

@echo off
::将禁用批处理脚本中的默认ANSI编码,同时设置编码为UTF-8(chcp 65001)
chcp 65001

:: 关闭程序(.exe是您要关闭的程序的文件名。如果您要关闭不同的程序,请替换成相应的文件名。)
taskkill /f /im cloudmusic.exe
echo 网易云音乐已关闭

taskkill /f /im DingtalkLauncher.exe
echo 钉钉已关闭

taskkill /f /im QQScLauncher.exe
echo qq已关闭


taskkill /f /im WeChat.exe
echo 微信已关闭

taskkill /f /im 有道云笔记.exe
echo 有道云笔记已关闭

taskkill /f /im Snipaste.exe
taskkill /f /im Everything.exe
taskkill /f /im Foxmail.exe


echo 所有程序已成功关闭
pause

五、修改网卡IP、掩码、网关

@echo off
chcp 65001
:: 设置IP地址
set /p choice=请选择设置类型(1:固定内网IP / 2:自动获取IP / 3:临时固定IP ):
echo.
if "%choice%"=="1" goto ip1
if "%choice%"=="2" goto ip2
if "%choice%"=="3" goto ip3
goto main
:ip1
echo 固定内网IP自动设置开始...
echo.
echo 正在设置固定内网IP及子网掩码
cmd /c netsh interface ip set address name="以太网" source=static addr=10.0.0.3 mask=255.255.255.0 gateway=10.0.0.1 gwmetric=1
echo 正在设置固定内网DNS服务器
cmd /c netsh interface ip add dnsservers name="以太网" address=10.0.0.35 index=1
cmd /c netsh interface ip add dnsservers name="以太网" address=114.114.114.114 index=2
echo 固定内网IP设置完成
pause
exit
if errorlevel 2 goto main
if errorlevel 1 goto end
:ip2
echo IP自动设置开始....
echo.
echo 自动获取IP地址....
netsh interface ip set address name = "以太网" source = dhcp
echo 自动获取DNS服务器....
netsh interface ip set dns name = "以太网" source = dhcp
@rem 设置自动获取IP
echo 设置完成
pause
exit
if errorlevel 2 goto main
if errorlevel 1 goto end
:ip3
echo 临时固定IP自动设置开始...
echo.
echo 正在设置临时固定IP及子网掩码
set /p ip=请输入需要配置的IP地址:
set /p ym=请输入需要配置的子网掩码:
set /p gt=请输入需要配置的网关:
cmd /c netsh interface ip set address name="以太网" source=static addr="%ip%" mask="%ym%" gateway="%gt%" gwmetric=1
echo 正在设置内网DNS服务器
cmd /c netsh interface ip add dnsservers name="以太网" address=114.114.114.114 index=1
cmd /c netsh interface ip add dnsservers name="以太网" address=8.8.8.8 index=2
echo 内网IP设置完成
pause
exit
if errorlevel 2 goto main
if errorlevel 1 goto end
:end

ipconfig/all确认网卡名称:
在这里插入图片描述

六、禁用&启用PC的USB接口

将文件保存为批处理文件,例如"disable_usb.bat"。以管理身份运行批处理文件,它将执行并禁用USB接口。

@echo off
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR" /v "Start" /t REG_DWORD /d 4 /f
echo USB接口已禁用。
pause

将文件保存为批处理文件,例如"enable_usb.bat"。以管理员身份运行批处理文件,它将执行并启用USB接口。

@echo off
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR" /v "Start" /t REG_DWORD /d 3 /f
echo USB接口已启用。
pause

七、配置win10 proxy

开启服务器

@echo off

REM 设置服务器地址和端口
set "proxyServer=10.0.1.245:7890"

REM 启用服务器
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 1 /f

REM 设置服务器地址和端口
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /d "%proxyServer%" /f

REM 刷新设置
netsh winhttp import proxy source=ie

echo 置已修改为:%proxyServer%

ipconfig

关闭服务器

@echo off

REM 关闭服务器
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 0 /f

REM 刷新设置
netsh winhttp reset proxy

echo 已关闭。

八、配置

retail Converted vol此脚本会对office版本进行转换将Retail版本转换成vol版本

::将禁用批处理脚本中的默认ANSI编码,同时设置编码为UTF-8(chcp 65001)
chcp 65001

title office2019 retail转换vol版

echo Josh修改版本 V1.0

echo 该工具用于测试使用!请勿用于商业用途!

if exist "%ProgramFiles%\Microsoft Office\Office16\ospp.vbs" cd /d "%ProgramFiles%\Microsoft Office\Office16"

if exist "%ProgramFiles(x86)%\Microsoft Office\Office16\ospp.vbs" cd /d "%ProgramFiles(x86)%\Microsoft Office\Office16"

cls

echo 正在重置Office2019零售激活...

cscript ospp.vbs /rearm

echo 正在安装 KMS 许可证...

for /f %%x in ('dir /b ..\root\Licenses16\ProPlus2019VL_kms*.xrm-ms') do cscript ospp.vbs /inslic:"..\root\Licenses16\%%x" >nul

echo 正在安装 MAK 许可证...

for /f %%x in ('dir /b ..\root\Licenses16\ProPlus2019VL_mak*.xrm-ms') do cscript ospp.vbs /inslic:"..\root\Licenses16\%%x" >nul

echo 正在安装 KMS 密钥...

cscript ospp.vbs /inpkey:NMMKJ-6RK4F-KMJVX-8D9MJ-6MWKP

echo.

echo 转化完成,按任意键退出!

pause >nul

exit

猜你喜欢

转载自blog.csdn.net/qq_39689711/article/details/130445141
今日推荐