本帖最后由 zidha 于 2019-8-26 07:17 编辑
想要的结果如下:
ComputerName:PC0001
如何实现?
ComputerName:这个是注释颜色不变,":"不行可以替换成__
PC0001需要字体高亮为颜色色。
测试过很多次只弄出如下脚本
注释和结果都变颜色了- @echo off
-
- set "zhushi=ComputerName__"
-
- set "str=HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\ComputerName\ComputerName"
- for /f "tokens=2*" %%a in ('reg query "%str%" /v ComputerName 2^>nul') do set "PCName=%%b"
-
- call:JV "%zhushi%%PCName%"
-
- goto:eof
-
- :JV
- set/p= <nul>"%1"
- findstr /a:0a .* "%1*" 2>nul
-
- del "%zhushi%%PCName%"
复制代码
|