China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-06-23 11:13
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Batch file I use after reinstalling the system View 744 Replies 2
Original Poster Posted 2009-02-12 03:58 ·  中国 黑龙江 牡丹江 电信
新手上路
Credits 8
Posts 7
Joined 2008-07-20 22:52
17-year member
UID 121795
Gender Male
From 黑龙江
Status Offline
I often make a fresh system to play around with, but every time after finishing it I still have to set up a whole series of commonly used system items and services, so I made a handy little batch file. This is my first time posting, so please go easy on me. The batch file may be pretty messy, so please help point out what to improve!


@echo off
title tian's little tool
color 0a
:start
echo 1.Disable all unnecessary system services
echo 2.Remove the shortcut arrow from desktop icons
echo 3.Change the IE homepage
echo 4.Change LAN IP and DNS address
echo 5.Disable IIS FTP SMTP WWWA services
echo 100.Exit
set /p zdt=Enter:

if "%zdt%" equ "1" (
sc config tlntsvr start= disabled
sc config termservice start= disabled
sc config sharedaccess start= disabled
net stop termservice
net stop sharedaccess
net stop tlntsvr
pause
cls
goto start
) else (
cls
goto a
)
:a
if "%zdt%" equ "2" (
reg delete hkey_classes_root\lnkfile /v isshortcut /f
reg delete hkey_classes_root\piffile /v isshortcut /f
pause
cls
goto start
) else (
cls
goto b
)
:b
if "%zdt%" equ "3" (
echo Choose www.hao123.com press 1
echo Choose www.baidu.com press 2
echo Choose www.google.com press 3
set /p x=Enter the number of the website you want:
if "%x%" equ "1" reg add "hkcu\software\microsoft\internet Explorer\Main" /v "start page" /d www.hao123.com /f
if "%x%" equ "2" reg add "hkcu\software\microsoft\internet Explorer\Main" /v "start page" /d www.baidu.com /f
if "%x%" equ "3" reg add "hkcu\software\microsoft\internet Explorer\Main" /v "start page" /d www.google.com /f
pause
cls
goto start
) else (
cls
goto c
)
:c
if "%zdt%" equ "4" (
echo To change the IP address to 192.168.1.2 choose 2
echo To change the IP address to 192.168.1.3 choose 3
echo To change the IP address to 192.168.1.4 choose 4
set /p d=Please enter:
if "%d%" equ "2" netsh interface ip set address "Local Area Connection" static 192.168.1.6 255.255.255.0 && netsh interface ip set dns "Local Area Connection" static 219.150.32.132 && netsh interface ip add dns "Local Area Connection" 219.146.0.130 index=2
if "%d%" equ "3" netsh interface ip set address "Local Area Connection" static 192.168.1.7 255.255.255.0 && netsh interface ip set dns "Local Area Connection" static 219.150.32.132 && netsh interface ip add dns "Local Area Connection" 219.146.0.130 index=2
if "%d%" equ "4" netsh interface ip set address "Local Area Connection" static 192.168.1.8 255.255.255.0 && netsh interface ip set dns "Local Area Connection" static 219.150.32.132 && netsh interface ip add dns "Local Area Connection" 219.146.0.130 index=2
pause & cls & goto start
) else (
cls
goto d
)
:d
if "%zdt%" equ "5" (
sc config iisadmin start= disabled
sc config msftpsvc start= disabled
sc config smtpsvc start= disabled
sc config w3svc start= disabled
net stop iisadmin /y
net stop msftpsvc
net stop smtpsvc
net stop w3svc
pause
cls
goto start
) else (
goto start & cls
)


[ Last edited by w450579598 on 2009-2-12 at 12:38 ]
Floor 2 Posted 2009-02-12 04:16 ·  美国 惠普HP
版主
★★★★★
Credits 9,023
Posts 5,017
Joined 2007-05-31 19:39
19-year member
UID 89899
Gender Male
Status Offline
Q: For the convenience of others copying it, how do I add a code tag to code?
A: http://www.cn-dos.net/forum/viewthread.php?tid=43735#pid304733
Reference: http://www.cn-dos.net/forum/faq.php?page=misc#1
Floor 3 Posted 2009-02-12 12:35 ·  中国 黑龙江 牡丹江 电信
新手上路
Credits 8
Posts 7
Joined 2008-07-20 22:52
17-year member
UID 121795
Gender Male
From 黑龙江
Status Offline

@echo off
title tian's little tool
color 0a
:start
echo 1.Disable all unnecessary system services
echo 2.Remove the shortcut arrow from desktop icons
echo 3.Change the IE homepage
echo 4.Change LAN IP and DNS address
echo 5.Disable IIS FTP SMTP WWWA services
echo 100.Exit
set /p zdt=Enter:

if "%zdt%" equ "1" (
sc config tlntsvr start= disabled
sc config termservice start= disabled
sc config sharedaccess start= disabled
net stop termservice
net stop sharedaccess
net stop tlntsvr
pause
cls
goto start
) else (
cls
goto a
)
:a
if "%zdt%" equ "2" (
reg delete hkey_classes_root\lnkfile /v isshortcut /f
reg delete hkey_classes_root\piffile /v isshortcut /f
pause
cls
goto start
) else (
cls
goto b
)
:b
if "%zdt%" equ "3" (
echo Choose www.hao123.com press 1
echo Choose www.baidu.com press 2
echo Choose www.google.com press 3
set /p x=Enter the number of the website you want:
if "%x%" equ "1" reg add "hkcu\software\microsoft\internet Explorer\Main" /v "start page" /d www.hao123.com /f
if "%x%" equ "2" reg add "hkcu\software\microsoft\internet Explorer\Main" /v "start page" /d www.baidu.com /f
if "%x%" equ "3" reg add "hkcu\software\microsoft\internet Explorer\Main" /v "start page" /d www.google.com /f
pause
cls
goto start
) else (
cls
goto c
)
:c
if "%zdt%" equ "4" (
echo To change the IP address to 192.168.1.2 choose 2
echo To change the IP address to 192.168.1.3 choose 3
echo To change the IP address to 192.168.1.4 choose 4
set /p d=Please enter:
if "%d%" equ "2" netsh interface ip set address "Local Area Connection" static 192.168.1.6 255.255.255.0 && netsh interface ip set dns "Local Area Connection" static 219.150.32.132 && netsh interface ip add dns "Local Area Connection" 219.146.0.130 index=2
if "%d%" equ "3" netsh interface ip set address "Local Area Connection" static 192.168.1.7 255.255.255.0 && netsh interface ip set dns "Local Area Connection" static 219.150.32.132 && netsh interface ip add dns "Local Area Connection" 219.146.0.130 index=2
if "%d%" equ "4" netsh interface ip set address "Local Area Connection" static 192.168.1.8 255.255.255.0 && netsh interface ip set dns "Local Area Connection" static 219.150.32.132 && netsh interface ip add dns "Local Area Connection" 219.146.0.130 index=2
pause & cls & goto start
) else (
cls
goto d
)
:d
if "%zdt%" equ "5" (
sc config iisadmin start= disabled
sc config msftpsvc start= disabled
sc config smtpsvc start= disabled
sc config w3svc start= disabled
net stop iisadmin /y
net stop msftpsvc
net stop smtpsvc
net stop w3svc
pause
cls
goto start
) else (
goto start & cls
)


[ Last edited by w450579598 on 2009-2-12 at 13:04 ]
Forum Jump: