树世界官网,手机报价 太平洋,怀孕有什么反映
主机实现hostname的修改原理:
修改注册表中的值:
hklm\system\currentcontrolset\control\computername\computername 下的 computername
hklm\system\currentcontrolset\control\computername\activecomputername 下的 computername
hklm\system\currentcontrolset\services\tcpip\parameters 下的 hostname
hklm\system\currentcontrolset\services\tcpip\parameters 下的 nv hostname
bat脚本实现:
@echo off if not "%os%"=="windows_nt" goto end if "%1"=="" ( set info=echo &&set skip=0&&set err=0 ) else if "%1"=="/?" ( set info=echo && set skip=1&&set err=0&&goto desc ) else if "%1"=="-q" ( set info=echo &&set err=1&&goto err ) else if "%1"=="-r" ( set info=echo &&set err=1&&goto err ) else ( set name=%1 && goto change ) %info% ******************************* %info% script:changehostname.bat %info% creation date : 2019/3/14 16:13 %info% last modified : 2019/3/14 20:49 %info% author: feiquan %info% email: 2283320260@qq.com :desc %info% ********************************* %info% description: %info% chang you hostname %info% ********************************* %info% examples: %info% changehostname.bat ===^> interact mode %info% changehostname.bat /? ===^> help mode %info% changehostname.bat "newhostname" ===^> commandline mode %info% changehostname.bat "newhostname" -q ===^> quiet mode %info% changehostname.bat "newhostname" -r ===^> restart sysetm after 60s %info% changehostname.bat "newhostname" -q -r ===^>quiet mode, restart sysetm after 60s %info% echo n ^| changehostname.bat "newhostname" -q ===^>quiet mode, no restart sysetm %info% ********************************* if "%skip%"=="1" goto end :start color 07 title change hostname setlocal enabledelayedexpansion for /f "skip=1 tokens=3" %%i in ('reg query "hklm\system\currentcontrolset\control\computername\computername" -v computername' ) do set nowhostname=%%i echo your computer hostname : %nowhostname% set /p n=please input new hostname : set name="!n!" echo. :change if "%2"=="-q" goto quiet if "%3"=="-q" goto quiet set /p sure=do you want to change hostname %name% ?(y/n) if /i not "%sure%"=="y" goto end :quiet reg add "hklm\system\currentcontrolset\control\computername\computername" -v computername -t reg_sz -d %name% -f reg add "hklm\system\currentcontrolset\control\computername\activecomputername" -v computername -t reg_sz -d %name% -f reg add "hklm\system\currentcontrolset\services\tcpip\parameters" -v hostname -t reg_sz -d %name% -f reg add "hklm\system\currentcontrolset\services\tcpip\parameters" -v "nv hostname" -t reg_sz -d %name% -f echo. for /f "skip=1 tokens=3" %%i in ('reg query "hklm\system\currentcontrolset\control\computername\computername" -v computername' ) do set nowhostname=%%i echo your computer hostname has changed : %nowhostname% echo after 60 seconds , restart your system.... if "%2"=="-r" goto resert if "%3"=="-r" goto resert set /p restart=do you want to restart your system after 60s ? (y/n) if /i not "%restart%"=="y" goto end :resert shutdown -r -t 60 -c "your computer hostname has changed : %nowhostname% . restart your system 60s ...." -d p:2:4 goto end :err echo format error , please with "changehostname.bat /? " to learn more .... :end echo exiting....
下载地址:
链接:https://pan.baidu.com/s/1ik3c0juf4um1hu58p9sj9a
提取码:p28f
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
新补丁让Windows 10出现死机、卡顿等 微软坐不住称正解决
Ubuntu 20.04 LTS进驻Windows子系统:只能用3年
ThinkPad正式加入:预装Linux发行版而非Win10的PC越来越多了
最新版Android 11推送!谷歌Pixel 5被曝光:支持反向充电
高度致敬Windows!开源优麒麟20.04 LTS发布:支持5年
电脑小知识:Windows 10是用什么语言写的?到底有多少行代码?
Win10 5月更新准正式版:微软引入大量新功能 系统响应速度快
Windows 10新预览版19613推送:修复任务栏图标显示异常BUG
Windows AD 报错解决:UAC File Virtualization服务启动失败 此驱动程序被阻止加载
网友评论