分类: WINDOWS
2011-06-03 16:49:52
Abner Kou原创,转载请注明出处http://abner.cublog.cn
批量修改屏幕分辨率
借助InstallRite2.5C和reg2bat两个小工具,没什么技术含量,算是一种制作脚本进行批量管理的一个思路。
一、任务:将300台计算机的分辨率由1024*768调整为800*600
二:制作脚本修改脚本
1、 在分辨率为1024*768的电脑上安装2.5C这款软件
具体实用方法参考
2、 在InstallRite中设置只监控注册表,设置完成后,程序会自动扫描当前注册表
3、 打开显示属性,修改分辨率为800*600
4、 点击“分析在最后一次快照后做出的更改”
5、 分析完成后,将修改后的HKEY_LOCAL_MACHINE键值导出,去掉不相干选项
6、 使用reg2bat工具将注册表文件转换成bat文件,转换完成后代码如下
@ECHO OFF
> "%Temp%.\DefOpen.reg" ECHO
REGEDIT4
>>"%Temp%.\DefOpen.reg"
ECHO.
>>"%Temp%.\DefOpen.reg"
ECHO.
>>"%Temp%.\DefOpen.reg"
ECHO [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Hardware
Profiles\0001\System\CurrentControlSet\Control\VIDEO\{4BFA0181-B404-4413-AB58-F3836C975712}\0000]
>>"%Temp%.\DefOpen.reg"
ECHO "DefaultSettings.XResolution"=dword:00000320
>>"%Temp%.\DefOpen.reg"
ECHO.
>>"%Temp%.\DefOpen.reg"
ECHO [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Hardware
Profiles\0001\System\CurrentControlSet\Control\VIDEO\{4BFA0181-B404-4413-AB58-F3836C975712}\0000]
>>"%Temp%.\DefOpen.reg"
ECHO "DefaultSettings.YResolution"=dword:00000258
>>"%Temp%.\DefOpen.reg"
ECHO.
>>"%Temp%.\DefOpen.reg"
ECHO [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Hardware
Profiles\0001\System\CurrentControlSet\Control\VIDEO\{4BFA0181-B404-4413-AB58-F3836C975712}\0000\Mon22446688]
>>"%Temp%.\DefOpen.reg"
ECHO "DefaultSettings.XResolution"=dword:00000320
>>"%Temp%.\DefOpen.reg"
ECHO.
>>"%Temp%.\DefOpen.reg"
ECHO [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Hardware Profiles\0001\System\CurrentControlSet\Control\VIDEO\{4BFA0181-B404-4413-AB58-F3836C975712}\0000\Mon22446688]
>>"%Temp%.\DefOpen.reg"
ECHO "DefaultSettings.YResolution"=dword:00000258
>>"%Temp%.\DefOpen.reg"
ECHO.
>>"%Temp%.\DefOpen.reg"
ECHO [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Hardware
Profiles\Current\System\CurrentControlSet\Control\VIDEO\{4BFA0181-B404-4413-AB58-F3836C975712}\0000]
>>"%Temp%.\DefOpen.reg"
ECHO "DefaultSettings.XResolution"=dword:00000320
>>"%Temp%.\DefOpen.reg"
ECHO.
>>"%Temp%.\DefOpen.reg" ECHO
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Hardware
Profiles\Current\System\CurrentControlSet\Control\VIDEO\{4BFA0181-B404-4413-AB58-F3836C975712}\0000]
>>"%Temp%.\DefOpen.reg"
ECHO "DefaultSettings.YResolution"=dword:00000258
>>"%Temp%.\DefOpen.reg"
ECHO.
>>"%Temp%.\DefOpen.reg"
ECHO [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Hardware
Profiles\Current\System\CurrentControlSet\Control\VIDEO\{4BFA0181-B404-4413-AB58-F3836C975712}\0000\Mon22446688]
>>"%Temp%.\DefOpen.reg"
ECHO "DefaultSettings.XResolution"=dword:00000320
>>"%Temp%.\DefOpen.reg"
ECHO.
>>"%Temp%.\DefOpen.reg"
ECHO [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Hardware
Profiles\Current\System\CurrentControlSet\Control\VIDEO\{4BFA0181-B404-4413-AB58-F3836C975712}\0000\Mon22446688]
>>"%Temp%.\DefOpen.reg"
ECHO "DefaultSettings.YResolution"=dword:00000258
>>"%Temp%.\DefOpen.reg"
ECHO.
>>"%Temp%.\DefOpen.reg"
ECHO
[HKEY_CURRENT_CONFIG\System\CurrentControlSet\Control\VIDEO\{4BFA0181-B404-4413-AB58-F3836C975712}\0000]
>>"%Temp%.\DefOpen.reg"
ECHO "DefaultSettings.XResolution"=dword:00000320
>>"%Temp%.\DefOpen.reg"
ECHO.
>>"%Temp%.\DefOpen.reg"
ECHO
[HKEY_CURRENT_CONFIG\System\CurrentControlSet\Control\VIDEO\{4BFA0181-B404-4413-AB58-F3836C975712}\0000]
>>"%Temp%.\DefOpen.reg"
ECHO "DefaultSettings.YResolution"=dword:00000258
>>"%Temp%.\DefOpen.reg"
ECHO.
>>"%Temp%.\DefOpen.reg"
ECHO
[HKEY_CURRENT_CONFIG\System\CurrentControlSet\Control\VIDEO\{4BFA0181-B404-4413-AB58-F3836C975712}\0000\Mon22446688]
>>"%Temp%.\DefOpen.reg" ECHO
"DefaultSettings.XResolution"=dword:00000320
>>"%Temp%.\DefOpen.reg"
ECHO.
>>"%Temp%.\DefOpen.reg"
ECHO
[HKEY_CURRENT_CONFIG\System\CurrentControlSet\Control\VIDEO\{4BFA0181-B404-4413-AB58-F3836C975712}\0000\Mon22446688]
>>"%Temp%.\DefOpen.reg"
ECHO "DefaultSettings.YResolution"=dword:00000258
>>"%Temp%.\DefOpen.reg"
ECHO.
>>"%Temp%.\DefOpen.reg"
ECHO.
START /WAIT REGEDIT /S
"%Temp%.\DefOpen.reg"
DEL "%Temp%.\DefOpen.reg"
三、使用
将此bat作为登陆脚本,或放到用户配置文件的启动项,用户登陆,重启之后分辨率自动更改。
四、另外分享一个同样方法制作的批量安装智能ABC输入法的脚本
@ECHO OFF
> "%Temp%.\DefOpen.reg" ECHO
Windows Registry Editor Version 5.00
>>"%Temp%.\DefOpen.reg"
ECHO.
>>"%Temp%.\DefOpen.reg"
ECHO [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard
Layouts\E0040804]
>>"%Temp%.\DefOpen.reg"
ECHO "IME file"="winabc.ime"
>>"%Temp%.\DefOpen.reg"
ECHO "Layout File"="kbdus.dll"
>>"%Temp%.\DefOpen.reg"
ECHO "Layout Text"="智能ABC"
>>"%Temp%.\DefOpen.reg"
ECHO.
>>"%Temp%.\DefOpen.reg"
ECHO [HKEY_CURRENT_USER\Keyboard Layout\Preload]
>>"%Temp%.\DefOpen.reg"
ECHO "10"="e0040804"
>>"%Temp%.\DefOpen.reg"
ECHO [HKEY_CURRENT_USER\Keyboard Layout\Preload]
>>"%Temp%.\DefOpen.reg"
ECHO "11"="00000409"
>>"%Temp%.\DefOpen.reg"
ECHO [HKEY_USERS\S-1-5-21-1592170928-870420327-728161355-500\Keyboard
Layout\Preload]
>>"%Temp%.\DefOpen.reg"
ECHO "10"="e0040804"
>>"%Temp%.\DefOpen.reg"
ECHO [HKEY_USERS\S-1-5-21-1592170928-870420327-728161355-500\Keyboard
Layout\Preload]
>>"%Temp%.\DefOpen.reg"
ECHO "11"="00000409"
START /WAIT REGEDIT /S
"%Temp%.\DefOpen.reg"
DEL "%Temp%.\DefOpen.reg"
xcopy \\10.0.0.5\E$\ZHINENGABC\abcwin.exe c:\windows\system32 /Y /Q
xcopy
\\10.0.0.5\E$\ZHINENGABC\inst.exe
c:\windows\system32 /Y /Q
xcopy
\\10.0.0.5\E$\ZHINENGABC\winabc.cnt
c:\windows\system32 /Y /Q
xcopy
\\10.0.0.5\E$\ZHINENGABC\winabc.cwd
c:\windows\system32 /Y /Q
xcopy \\10.0.0.5\E$\ZHINENGABC\winabc.hlp c:\windows\system32 /Y /Q
xcopy
\\10.0.0.5\E$\ZHINENGABC\winabc.ovl
c:\windows\system32 /Y /Q
xcopy \\10.0.0.5\E$\ZHINENGABC\winabcnt.ime
c:\windows\system32 /Y /Q
xcopy \\10.0.0.5\E$\ZHINENGABC\winabcx.ovl
c:\windows\system32 /Y /Q
xcopy
\\10.0.0.5\E$\ZHINENGABC\winabc.ime
c:\windows\system32 /Y /Q