Host implementation hostname The principle of modification :

Modify the value in the registry :

hklm\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName Under the  ComputerName

hklm\SYSTEM\CurrentControlSet\Control\ComputerName\ActiveComputerName Under the  ComputerName

hklm\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters  Under the  Hostname

hklm\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters Under the  NV Hostname

bat Script implementation :

@echo off
if not "%OS%"=="Windows_NT" goto END
if "%1"=="" (
set INFO=echo &&set skip=&&set err=
) else if "%1"=="/?" (
set INFO=echo && set skip=&&set err=&&goto DESC
) else if "%1"=="-q" (
set INFO=echo &&set err=&&goto ERR
) else if "%1"=="-r" (
set INFO=echo &&set err=&&goto ERR
) else (
set name=% && goto CHANGE
) %INFO% *******************************
%INFO% Script:ChangeHostname.bat
%INFO% Creation Date : // :
%INFO% Last Modified : // :
%INFO% Author: feiquan
%INFO% Email: @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%"=="" goto END :START
color 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 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 -c "Your computer hostname has changed : %nowHostname% . Restart your system 60s ...." -d p::
goto END :ERR
echo Format Error , Please with "ChangeHostname.bat /? " to learn more .... :END
echo exiting....

Download address :

link :https://pan.baidu.com/s/1Ik3C0juf4um1hU58p9sj9A
Extraction code :p28f

bat Implement host hostname More articles related to the revision of

  1. CentOS6 Modify hostname (hostname) And modify /etc/hosts file , increase ip and hostname The mapping relation of ( turn )

    CentOS Modify hostname (hostname)   Two changes are needed : A place is /etc/sysconfig/network, The other is /etc/hosts, Modifying any of them will cause the system to start abnormally . First switch to root user . ...

  2. Modify host hostname

    1 modify hostname The configuration file vi /etc/sysconfig/network Medium HOSTNAME 2 After modification , Use hostname Command to verify , Find out hostname It's still the same sign out shell again ...

  3. linux @ How to modify the following host name

    @ The back is linux Host name of the system Temporary modification method : perform hostname The host name is executed again bash Permanent modification method : Modify the configuration file /etc/sysconfig/network Modify the parameters HOSTNAME= The host name is ...

  4. CentOS6.3 Hostname Set, modify

    Today I installed a CentOS6.3 Okay , Basically refer to Baidu Library above the article to install http://wenku.baidu.com/link?url=K0tqotryKLFHhJGicx1nC-hsgfWhL3OI ...

  5. Manager Xingyun V4.7 New product features - International Version 、 Support Oracle Database audit for 、 Host password automatic modification policy Release date :2018-11-22

    Cloud manager online experience : Manager Xingyun [ Official website ]- Leading cloud computing management platform - Cloud security , Fortress machine , Automatic operation and maintenance ​ Xingyun housekeeper novice courtesy activities : The novice of Xingyun housekeeper is polite , new user 1 Yuan to experience the professional version - Coupon ​ Release date :2018-11-22 ...

  6. ubuntu How to modify terminal The host name of the terminal ( modify /etc/hostname file )

    Sometimes the installation is complete Ubuntu After the system , Open the command terminal , The format of the host name displayed on the terminal is rather unsightly , for example I recently bought a cloud in China VPS. xxx@VM-1560-ubuntu$ xxx@VM-1560-ubuntu$ For you Jie ...

  7. samba The configuration file that the server needs to modify to join the domain control host

    samba The server joins the domain control host , Become a member of the domain , When users access samba When sharing files on the server , Directly to the domain control host for authentication .samba There is no need to create system users on the server as before , establish samba User and password . 1. Installation environment ( ...

  8. Linux Host name domain name modification problem

    1. modify /etc/sysconfig/network  The configuration file  vi  /etc/sysconfig/network modify HOSTNAMEHOSTNAME=new-hostname.domainn ...

  9. Ubuntu 13.04 Host name modification

    For some reason , To be modified Ubuntu The host name , evening Google For a moment , The place to be changed is /etc/hostname, Replace the string with the host name you want to start . sudo vi /etc/hostname Modification is ...

Random recommendation

  1. C# Notes on value types and reference types

      Value type Reference type Memory allocation location The allocation is in the stack Allocated in the heap efficiency Efficient , No need for address translation Low efficiency , Need to do address translation Memory recovery After use , Recycle immediately After use , Not immediately , wait for GC Recycling Assignment operation Make a reply ...

  2. ifame Cross domain highly adaptive

    The code is as follows :var iframeids = ['memberIndexIframe','inquiryCenterIframe','everychinaBbsIframe']; var iframehi ...

  3. Samsung's original factory is K9K8G08U0D Upgrade to K9K8G08U0E In response to the letter

     1. please check the below timing first. K9F1G08U0E vs K9F1G08U0D Timing difference tR tPROG tBERS N ...

  4. shell Built in commands in , Functions and external commands

    from shell Built in commands in , Functions and external commands Shell Identify three basic commands : Built in command .Shell Functions and external commands : (1) Built in command is created by Shell The command executed by itself .    Some commands are built in because of their necessity ...

  5. D3.js data() Methods,

    Binding data( Data binding ) D3 The function of all kinds of charts is to put the data (Data) Converting to a visual process . For example, one month's temperature data , Through the tree to show , Can see the temperature trend intuitively , Do you need to wear autumn pants next month :) I ...

  6. JDBC The batch operation

    /**          * Batch execution of predefined patterns SQL          */         public static void exeBatchParparedSQL() {          ...

  7. lucene Details of inverted index buffer pool

    What information should inverted index store When it comes to inverted indexes , The first feeling is the word to document list mapping , actually , Inverted indexes need to store more than just lists of words and documents . In order to use cosine similarity to calculate the similarity between search terms and documents , You need to calculate the... For each word in the document TF-IDF value , ...

  8. git The basic application of ( One )

    Git Common commands : mkdir   Folder name            Create folder git  init                      Hand in the folder git management ls -ah              ...

  9. C# Finding the mode of a group of numbers

    private int GetModeNum(List<int> listValue) { List<int> listName = new List<int>() ...

  10. MyEvent.SetEvent; // Synchronous signal set

    MyEvent.SetEvent;   //   Synchronous signal set TSimpleEvent.Create = TEvent.Create(nil, True, False, nil)           ...