实例1:================================================================
@echo off
color 0atitle 火星II代配置脚本 by operation——SunShine
:start
@echo 请根据您的需要进行更改项目。by operation——SunShine
@echo ---------------------------------
echo 1-- 按顺序 修改网卡信息--计算机名--重命名用户并修改密码
echo 2-- alter—network
echo 3-- computer_name
echo 4-- alter(User/password)
echo 5-- New Document (hi_chinabackup/hi_rescoveryback)
echo 6-- clear rubbish
echo 7-- exit
@echo ---------------------------------
set /p key=请输入您要更改的编号:
if %key%==1 goto global
if %key%==2 goto eth
if %key%==3 goto computer_name
if %key%==4 goto rename_password
if %key%==5 goto new_document
if %key%==6 goto clear rubbish
if %key%==7 goto exit
cls
@echo 你的选择是错误的,请重新选择
goto start
:global
@echo ---------------------------------
@echo 现在正在进行的是全局更改
@echo ---------------------------------
echo 哈哈哈……………………现在还不支持,还是一步一步来吧。。。
pause
sunshine.bat
goto end
:eth
@echo ---------------------------------
@echo 现在是在进行更改 网卡 的操作
@echo ---------------------------------
@ipconfig |more
@echo 请选择网卡,1、本的连接/2、本的连接2
set /p eth=网卡编号:
set /p ip=请输入IP:
set /p mask=请输入mask:
set /p gateway=请输入网关:
if %eth%==1 netsh interface ip set address name="本的连接" source=static addr=%ip% mask=%mask% gateway=%gateway% gwmetric=1 | netsh interface ip set dns name="本地连接" source=static addr=202.102.224.68 register=PRIMARY | netsh interface ip add dns name="本地连接" addr=202.102.227.68 index=2
if %eth%==2 netsh interface ip set address name="本的连接 2" source=static addr=%ip% mask=%mask% gateway=%gateway% gwmetric=1 | netsh interface ip set dns name="本地连接 2" source=static addr=202.102.224.68 register=PRIMARY | netsh interface ip add dns name="本地连接 2" addr=202.102.227.68 index=2
@echo .
@echo 下面将查看网卡信息和连通性测试
@echo .
@ipconfig |more
@ping www.qq.com
pause
sunshine.bat
goto end
:computer_name
@echo ---------------------------------
@echo 现在是进行更改 计算机名 的操作
@echo ---------------------------------
set /p name=请输您的计算机名:
reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ComputerName\ActiveComputerName" /v ComputerName /t reg_sz /d %name% /f >nul 2>nul
reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters" /v "NV Hostname" /t reg_sz /d %name% /f >nul 2>nul
reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters" /v Hostname /t reg_sz /d %name% /f >nul 2>nul
echo.
echo 修改计算机名完毕
echo.
@hostname
pause
sunshine.bat
goto end
:rename_password
@echo ---------------------------------
@echo 现在是在进行更改 administrator和password 的操作
@echo ---------------------------------
@net user
set /p user=您要更改的用户名:
set /p newuser=新的用户名:
set /p pass=请输入密码:
@wmic useraccount where name='%user%' call rename %newuser%
@net user %name% %pass%
@net user
pause
sunshine.bat
goto end
:new_document
@md e:\hi_chinabackup e:\hi_rescoveryback
@dir
pause
sunshine.bat
goto end
:clear rubbish
echo 正在清理系统垃圾文件,请稍等......
del /f /s /q %systemdrive%\*.tmp
del /f /s /q %systemdrive%\*._mp
del /f /s /q %systemdrive%\*.log
del /f /s /q %systemdrive%\*.gid
del /f /s /q %systemdrive%\*.chk
del /f /s /q %systemdrive%\*.old
del /f /s /q %systemdrive%\recycled\*.*
del /f /s /q %windir%\*.bak
del /f /s /q %windir%\prefetch\*.*
rd /s /q %windir%\temp & md %windir%\temp
del /f /q %userprofile%\cookies\*.*
del /f /q %userprofile%\recent\*.*
del /f /s /q "%userprofile%\Local Settings\Temporary Internet Files\*.*"
del /f /s /q "%userprofile%\Local Settings\Temp\*.*"
del /f /s /q "%userprofile%\recent\*.*"
echo 清理系统垃圾完成!
echo. & pause
sunshine.bat
goto end
:exit
exit
goto end
:end
echo this is the end
实例2=================================================================
@echo off
color 5e
cls
setlocal
set pwd=0
set times=2
:check
ECHO ╭══☆→═════════════════════じ☆ve═╮
ECHO ║ ║
ECHO ║ 流氓特警 ║
ECHO ║ ║
ECHO ╰══じ☆ve════════════════════←☆══╯
echo.
echo.
set /p pwd= 输 入 密 码:
if "%pwd%"=="sunshine" goto pass
if %times%==0 goto close
exit
set /A times=%times%-1
:close
exit
:pass
cls
ECHO ╭══☆→═════════════════════じ☆ve═╮
ECHO ║ ║
ECHO ║ 流氓特警 ║
ECHO ║ ║
ECHO ╰══じ☆ve════════════════════←☆══╯
echo.
echo.
ver
goto main
color 3e
:main
cls
:check
ECHO ╭══☆→═════════════════════じ☆ve═╮
ECHO ║ ║
ECHO ║ 流氓特警 ║
ECHO ║ ║
ECHO ╰══じ☆ve════════════════════←☆══╯
echo.
echo.
echo 1.修改计算机名
echo.
echo 2.修改计算机IP
echo.
echo 3.禁止邻居属性
echo.
echo 4.恢复邻居属性
echo.
echo 5.清理系统垃圾
echo.
echo 6.显示所有磁盘(这个功能有问题,不要使用)
echo.
echo 7.重启动计算机
echo.
echo 8.退出这个程序
echo.
echo 请输入1,2,3,4,5,6,7输入其他字符,后果自负.
:restart1
set /p select=请输入:
set /a select=%select%-0
if %select%==1 goto name
if %select%==2 goto ip
if %select%==3 goto jinzhi
if %select%==4 goto huifu
if %select%==5 goto laji
if %select%==6 goto disk
if %select%==7 goto chongqi
if %select%==8 goto endend
if %select% gtr 8 goto errorselect1
:name
cls
echo -------------------------------------------------------
echo.
echo 说明
echo 本批处理是修改计算机名
echo -------------------------------------------------------
:restart5
@echo off
set /p name=请输您的计算机名:
reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ComputerName\ActiveComputerName" /v ComputerName /t reg_sz /d %name% /f
reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters" /v "NV Hostname" /t reg_sz /d %name% /f
reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters" /v Hostname /t reg_sz /d %name% /f
goto main
:ip
cls
echo -------------------------------------------------------
echo.
echo 说明
echo 本批处理是修改计算机ip
echo -------------------------------------------------------
:restart5
@echo off
set slection1=
set/p slection1=请输入IP地址:
netsh interface ip set address name="本地连接" source=static addr=%slection1% mask=255.255.255.0
set slection2=
goto main
:jinzhi
cls
echo -------------------------------------------------------
echo.
echo 说明
echo 本批处理是禁止网络邻居属性
echo -------------------------------------------------------
:restart5
@echo off
Regsvr32 /u Netshell.dll /s
goto main
:huifu
cls
echo -------------------------------------------------------
echo.
echo 说明
echo 本批处理是恢复网络邻居属性
echo -------------------------------------------------------
:restart5
@echo off
Regsvr32 Netshell.dll /s
goto main
:laji
cls
echo -------------------------------------------------------
echo.
echo 说明
echo 本批处理是清理系统垃圾
echo -------------------------------------------------------
:restart5
@echo off
echo off
echo 正在清除系统垃圾文件,请稍等......
del /f /s /q %systemdrive%\*.tmp
del /f /s /q %systemdrive%\*._mp
del /f /s /q %systemdrive%\*.log
del /f /s /q %systemdrive%\*.gid
del /f /s /q %systemdrive%\*.chk
del /f /s /q %systemdrive%\*.old
del /f /s /q %systemdrive%\recycled\*.*
del /f /s /q %windir%\*.bak
del /f /s /q %windir%\prefetch\*.*
rd /s /q %windir%\temp & md %windir%\temp
del /f /q %userprofile%\cookies\*.*
del /f /q %userprofile%\recent\*.*
del /f /s /q "%userprofile%\Local Settings\Temp\*.*"
del /f /s /q "%userprofile%\Local Settings\Temporary Internet Files\*.*"
del /f /s /q "%userprofile%\recent\*.*"
del /f /s /q "%userprofile%\Local Settings\History\*.*"
del /f /s /q "%userprofile%\Local Settings\Temp\*.*"
del /f /s /q "%userprofile%\UserData\*.*"
del /f /s /q "%userprofile%\Cookies\*.*"
del /f /s /q "%userprofile%\Templates\*.*"
del /f /s /q "E:\Temporary Internet Files\*.*"
sfc /purgecache '清理系统盘无用文件
defrag %systemdrive% -b '优化预读信息
echo 清除系统LJ完成!
goto main
:disk
cls
echo -------------------------------------------------------
echo.
echo 说明
echo 本批处理是显示所有磁盘
echo -------------------------------------------------------
:restart5
@echo off
echo 这个功能暂时不好使。。。
#reg add HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer /v NoDrives /d dword:00000000 /f
goto main
:chongqi
cls
echo -------------------------------------------------------
echo.
echo 说明
echo 本批处理是重新启动计算机
echo -------------------------------------------------------
:restart5
@echo off
//关闭命令行显示
%systemroot%\system32\shutdown -r -t 0
:errorselect5
echo 选择错误,请重新选择
goto restart5
:errorselect1
echo 选择错误,请重新选择
goto restart1
:endend
版权所有:《太阳花工作室》 => 《更改网卡信息,计算机名、用户信息。bat脚本》
本文地址:http://bg.artuion.com/windows/3.html
除非注明,文章均为 《太阳花工作室》 原创,欢迎转载!转载请注明本文地址,谢谢。