最近在做一个包的时候,轻狂遇到了转换大小写的问题,网络上似乎没有相关例子可以借鉴,研究了一下发现用WordFunc.nsh头文件可以实现,于是记一下方便大家。
;从注册表中读取当前计算机名 ReadRegStr $R1 HKLM "SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName" "ComputerName" MessageBox MB_OK "计算机名$R1" ;把字符串转换为大写,如果转换为小写则把+改为-即可,还可以设置某些字符不转换哦 ${StrFilter} "$R1" "+" "" "" $R2 MessageBox MB_OK "转换后的计算机名$R2" ;把计算机名全部改为大写 WriteRegStr HKLM "SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName" "ComputerName" "$R2" WriteRegStr HKLM "SYSTEM\CurrentControlSet\Control\ComputerName\ActiveComputerName" "ComputerName" "$R2" WriteRegStr HKLM "SYSTEM\CurrentControlSet\services\Tcpip\Parameters" "NV Hostname" "$R2" WriteRegStr HKLM "SYSTEM\CurrentControlSet\services\Tcpip\Parameters" "Hostname" "$R2" WriteRegStr HKLM "SYSTEM\ControlSet001\Control\ComputerName\ComputerName" "ComputerName" "$R2" WriteRegStr HKLM "SYSTEM\ControlSet001\Control\ComputerName\ActiveComputerName" "ComputerName" "$R2" WriteRegStr HKLM "SYSTEM\ControlSet001\services\Tcpip\Parameters" "NV Hostname" "$R2" WriteRegStr HKLM "SYSTEM\ControlSet001\services\Tcpip\Parameters" "Hostname" "$R2" WriteRegStr HKLM "SYSTEM\ControlSet002\Control\ComputerName\ComputerName" "ComputerName" "$R2" WriteRegStr HKLM "SYSTEM\ControlSet002\services\Tcpip\Parameters" "NV Hostname" "$R2" WriteRegStr HKLM "SYSTEM\ControlSet002\services\Tcpip\Parameters" "Hostname" "$R2" WriteRegStr HKCU "Software\Microsoft\Windows Media\WMSDK\General" "ComputerName" "$R2" WriteRegStr HKCU "Volatile Environment" "LOGONSERVER" "\\$R2" WriteRegStr HKCU "Volatile Environment" "USERDOMAIN" "$R2" |