|
|
发表于 2022-1-4 13:46:54
|
显示全部楼层
win10系统测试,2楼代码也没问题:- Microsoft Windows [版本 10.0.19042.1415]
- (c) Microsoft Corporation。保留所有权利。
- C:\Users\Administrator>cd desktop
- C:\Users\Administrator\Desktop>type a.txt
- @Echo Off
- Title Reg Converter v1.1 & Color 1A
- cd %systemroot%\system32
- call :IsAdmin
- Reg.exe add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\MpsSvc\Parameters\PortKeywords\DHCP" /v "Collection" /t REG_BINARY /d "" /f
- Reg.exe add "HKEY_USERS\S-1-5-21-3291519012-2868546545-2290023086-500\Console" /v "WindowPosition" /t REG_DWORD /d "9830700" /f
- Exit
- :IsAdmin
- Reg.exe query "HKU\S-1-5-19\Environment"
- If Not %ERRORLEVEL% EQU 0 (
- Cls & Echo You must have administrator rights to continue ...
- Pause & Exit
- )
- Cls
- goto:eof
- C:\Users\Administrator\Desktop>type b.txt
- @Echo Off
- Title Reg Converter v1.1 & Color 1A
- cd %systemroot%\system32
- call :IsAdmin
- :IsAdmin
- Reg.exe query "HKU\S-1-5-19\Environment"
- If Not %ERRORLEVEL% EQU 0 (
- Cls & Echo You must have administrator rights to continue ...
- Pause & Exit
- )
- Cls
- goto:eof
- C:\Users\Administrator\Desktop>type test11.bat
- @echo off
- findstr /v /g:b.txt a.txt
- pause
- C:\Users\Administrator\Desktop>test11.bat
- Reg.exe add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\MpsSvc\Parameters\PortKeywords\DHCP" /v "Collection" /t REG_BINARY /d "" /f
- Reg.exe add "HKEY_USERS\S-1-5-21-3291519012-2868546545-2290023086-500\Console" /v "WindowPosition" /t REG_DWORD /d "9830700" /f
- Exit
- 请按任意键继续. . .
复制代码 |
|