2022年4月23日星期六

常用CMD命令

1、电脑名称、IP地址、MAC地址获取:

ipconfig/all

ipconfig/all >D:1.txt


Windows 默认系统环境变量:
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\

2、刷新DNS:

ipconfig /flushdns


3、Bat批处理实现代理设置与取消


设置代理

@echo off
echo Setting the proxyServer ....
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 1 /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /d "代理IP:代理端口" /f
color 2
echo Set the proxyserver successfully !
echo Press any key to continue
pause>nul

取消代理

@echo off 
echo Removing the proxyserver ...
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 0 /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /d "" /f
color 2
echo Remove the proxyserver successfully !
echo Press any key to continue 
pause>nul