最新消息:

把计算机名转换为大写或小写字符

nsis 永恒心锁 2191浏览 0评论
现用WordFunc.nsh头文件可以实现,于是记一下方便大家。
;从注册表中读取当前计算机名
ReadRegStr $R1 HKLM "SYSTEMCurrentControlSetControlComputerNameComputerName" "ComputerName"
MessageBox MB_OK "计算机名$R1"
;把字符串转换为大写,如果转换为小写则把+改为-即可,还可以设置某些字符不转换哦
${StrFilter} "$R1" "+" "" "" $R2
MessageBox MB_OK "转换后的计算机名$R2"
;把计算机名全部改为大写
WriteRegStr   HKLM "SYSTEMCurrentControlSetControlComputerNameComputerName" "ComputerName" "$R2"
WriteRegStr   HKLM "SYSTEMCurrentControlSetControlComputerNameActiveComputerName" "ComputerName" "$R2"
WriteRegStr   HKLM "SYSTEMCurrentControlSetservicesTcpipParameters" "NV Hostname" "$R2"
WriteRegStr   HKLM "SYSTEMCurrentControlSetservicesTcpipParameters" "Hostname" "$R2"
WriteRegStr   HKLM "SYSTEMControlSet001ControlComputerNameComputerName" "ComputerName" "$R2"
WriteRegStr   HKLM "SYSTEMControlSet001ControlComputerNameActiveComputerName" "ComputerName" "$R2"
WriteRegStr   HKLM "SYSTEMControlSet001servicesTcpipParameters" "NV Hostname" "$R2"
WriteRegStr   HKLM "SYSTEMControlSet001servicesTcpipParameters" "Hostname" "$R2"
WriteRegStr   HKLM "SYSTEMControlSet002ControlComputerNameComputerName" "ComputerName" "$R2"
WriteRegStr   HKLM "SYSTEMControlSet002servicesTcpipParameters" "NV Hostname" "$R2"
WriteRegStr   HKLM "SYSTEMControlSet002servicesTcpipParameters" "Hostname" "$R2"
WriteRegStr   HKCU "SoftwareMicrosoftWindows MediaWMSDKGeneral" "ComputerName" "$R2"
WriteRegStr   HKCU "Volatile Environment" "LOGONSERVER" "\$R2"
WriteRegStr   HKCU "Volatile Environment" "USERDOMAIN" "$R2"
永恒心锁,版权所有丨如未注明,均为转载丨本网站采用BY-NC-SA协议进行授权

转载请注明:永恒心锁-分享互联网 » 把计算机名转换为大写或小写字符

您必须 登录 才能发表评论!