标签(空格分隔): UAC Hostname UniqueName
####This code snap add a UAC privilege to .bat files
REM This batfile just add a UAC auth to .bat
reg add "HKEY_CLASSES_ROOT\batfile\shell\open" /v HasLUAShield /t REG_SZ
####This code snap firstly generates an alphanumeric string in length 14,indicating an unique host in WLAN.The first character is W that represents a Windows machine.The remains choose randomly from CHARS string.After this step,we modify the registry and need a restart action,so just shutdown -r -t 0
@echo off
REM This is a random alpha-num generator
REM This script generates a string of these characters at least
REM You can change the CHAR_LENGTH TO generates other alpha-nums
SET CHARS=abcdefghijklmnopqrstuvwxyz0123456789
SET /A CHAR_LENGTH=26+10
SET /A ALPHA_LENGTH=14
SET HOSTNAME=W
SetLocal EnableDelayedExpansion
SET LINE=
FOR /L %%a in (1 1 %ALPHA_LENGTH%) do (
SET /A CHAR_INDEX=!random! %% %CHAR_LENGTH%
CALL SET EXTRACTED_CHAR=%%CHARS:~!CHAR_INDEX!,1%%
SET LINE=!LINE!!EXTRACTED_CHAR!
)
SET HOSTNAME=%HOSTNAME%%LINE%
reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ComputerName\ActiveComputerName" /v ComputerName /t reg_sz /d %HOSTNAME% /f
reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ComputerName\ComputerName" /v ComputerName /t reg_sz /d %HOSTNAME% /f
reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters" /v "NV Hostname" /t reg_sz /d %HOSTNAME% /f
reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters" /v Hostname /t reg_sz /d %HOSTNAME% /f
REM Now restart
shutdown -r -t 0