Some useful command in Batch File of Windows

时间:2022-10-18 23:35:43

Some useful command in Batch File of Windows One of my friends want me to help him building an automatically script for installing one or more special software, the operations include modify windows registry, updating the homepage of windows internet explorer and changing start-mode of some windows services. I have referred some documentation and made this notes for you guys.

Add new record into Host file

echo #SomeComments>>%windir%\system32\drivers\etc\hosts
echo [IP Address]   [Host Name]>>%windir%\system32\drivers\etc\hosts

Start services

net start [Service Name]

or

sc start [Service Name]

Configure the start-mode of some service

sc config [Service Name] start= [auto|demand|…]

Set the homepage of Internet Explorer

reg add "HKCU\Software\Microsoft\Internet Explorer\Main" /v "Start Page" /d "[Homepage URL]" /f

Set the title of Internet Explorer

reg add "HKCU\Software\Microsoft\Internet Explorer\Main" /v "Window Title" /d "[Title]" /f