Tools/Linux_reinstall/Windows/SetupComplete.bat

27 lines
724 B
Batchfile
Raw Normal View History

2023-07-02 15:12:01 +08:00
@echo off
set setmode=on
::Static IP
2023-07-04 23:50:23 +08:00
set staticip=IPv4
2023-07-02 15:12:01 +08:00
::Subnet
set subnetmask=actualIp4Subnet
::Gateway
2023-07-04 23:50:23 +08:00
set gateways=GATE
2023-07-02 15:12:01 +08:00
::Dns
set dnsserver1=ipDNS1
set dnsserver2=ipDNS2
2023-07-05 04:06:52 +08:00
::Expand system partition
set systemDisk=%SystemDrive:~0,1%
for /f "tokens=2" %%a in ('echo list vol ^| diskpart ^| findstr "\<%systemDisk%\>"') do (echo select disk 0 & echo select vol %%a & echo extend) | diskpart
2023-07-02 15:12:01 +08:00
echo;%setmode%|find "on"&&goto:enable||goto:disable
:enable
wmic nicconfig where ipenabled=true call enablestatic(%staticip%),(%subnetmask%)
wmic nicconfig where ipenabled=true call setgateways(%gateways%)
2023-07-05 01:03:38 +08:00
wmic nicconfig where ipenabled=true call setdnsserversearchorder(%dnsserver1%,%dnsserver2%)
2023-07-05 01:24:08 +08:00
del %0
2023-07-05 04:06:52 +08:00
pause
2023-07-02 15:12:01 +08:00
:disable
2023-07-05 04:06:52 +08:00
del %0
pause