这一次,我不知道如何在 Bash 和 Batch 脚本中制作
1 - 检测当前分辨率
2 - 在注册表项中写入该分辨率
3 - 我不知道“dword”中的所有分辨率,有人可以帮助我,任何屏幕的所有分辨率,2:1,4:3,5:4,11:6,15:9,16:9,16 :10 , 25:16 , 60:29 , 72:35 , 任意
现在,例如,在“Bash”脚本中的“No Windows SO”下使用 Wine。它更实际的用途是这样的->
A - 以获取Linux下的当前分辨率为例 ->
echo `xrandr --current | grep current | awk '{print $8}'` >> Resolution1
echo `xrandr --current | grep current | awk '{print $10}'` >> Resolution2
cat Resolution2 | sed -i 's/,//g' Resolution2
P1Resolution=$(cat Resolution1)
P2Resolution=$(cat Resolution2)
rm Resolution1 Resolution2
echo "$P1Resolution"'x'"$P2Resolution" >> Resolution
Resolution=$(cat Resolution)
rm Resolution
B - 编写注册表文件,例如“魔兽争霸 3”或“Ragnarok Classic International”
魔兽争霸3:->
if [ $Resolution = "640x480" ]; then
echo "REGEDIT4" >> video.reg
echo "" >> video.reg
echo "[HKEY_CURRENT_USER\Software\Blizzard Entertainment\Warcraft III\Video]" >> video.reg
echo '"resHEIGHT"=dword:000001e0' >> video.reg
echo '"resWIDTH"=dword:00000280' >> video.reg
# Add ResolutionRate
echo '"ResolutionRatehrate"=dword:00000046' >> video.reg
regedit -s video.reg
elif [ $Resolution = "800x600" ]; then
echo "REGEDIT4" >> video.reg
echo "" >> video.reg
echo "[HKEY_CURRENT_USER\Software\Blizzard Entertainment\Warcraft III\Video]" >> video.reg
echo '"resHEIGHT"=dword:00000258' >> video.reg
echo '"resWIDTH"=dword:00000320' >> video.reg
# Add ResolutionRate
echo '"ResolutionRatehrate"=dword:00000046' >> video.reg
regedit -s video.reg
elif [ $Resolution = "1024x768" ]; then
echo "REGEDIT4" >> video.reg
echo "" >> video.reg
echo "[HKEY_CURRENT_USER\Software\Blizzard Entertainment\Warcraft III\Video]" >> video.reg
echo '"resHEIGHT"=dword:00000300' >> video.reg
echo '"resWIDTH"=dword:00000400' >> video.reg
# Add ResolutionRate
echo '"ResolutionRatehrate"=dword:00000046' >> video.reg
regedit -s video.reg
rm -rf video.reg
else
echo "Unknow Resolution"
fi
现在好了,诸神黄昏国际:->
if [ $Resolution = "640x480" ]; then
echo "REGEDIT4" >> video.reg
echo "" >> video.reg
echo "[HKEY_LOCAL_MACHINE\SOFTWARE\Gravity Soft\Ragnarok]" >> video.reg
echo '"HEIGHT="=dword:000001e0' >> video.reg
echo '"WIDTH"=dword:00000280' >> video.reg
regedit -s video.reg
elif [ $Resolution = "800x600" ]; then
echo "REGEDIT4" >> video.reg
echo "" >> video.reg
echo "[HKEY_LOCAL_MACHINE\SOFTWARE\Gravity Soft\Ragnarok]" >> video.reg
echo '"HEIGHT"=dword:00000258' >> video.reg
echo '"WIDTH"=dword:00000320' >> video.reg
regedit -s video.reg
elif [ $Resolution = "1024x768" ]; then
echo "REGEDIT4" >> video.reg
echo "" >> video.reg
echo "[HKEY_LOCAL_MACHINE\SOFTWARE\Gravity Soft\Ragnarok]" >> video.reg
echo '"HEIGHT"=dword:00000300' >> video.reg
echo '"WIDTH"=dword:00000400' >> video.reg
regedit -s video.reg
rm -rf video.reg
else
echo "Unknow Resolution"
fi
Okey 在 Bash 中运行良好,现在在 Batch 中,我可以从中获得本机“Windows”下的“当前分辨率”???
批处理脚本的一部分,类似于:
Warcraft 3 :->
@echo off
color A
title Automatic Resolution Setup
set key1=HKEY_CURRENT_USER\Software\Blizzard Entertainment\
set key2=HKEY_CURRENT_USER\Software\Blizzard Entertainment\Warcraft III
set key3=HKEY_CURRENT_USER\Software\Blizzard Entertainment\Warcraft III\Video
reg delete "%key1%" /f
reg add "%key1%" /f
reg add "%key2%" /f
reg add "%key3%" /f
reg add "%key3%" /t REG_DWORD /v reswidth /d %CURRENT_WIDTH% /f
reg add "%key3%" /t REG_DWORD /v reshieght /d %CURRENT_HEIGHT% /f
诸神黄昏国际:->
@echo off
color A
title Automatic Resolution Setup
set key=HKEY_LOCAL_MACHINE\SOFTWARE\Gravity Soft\Ragnarok
reg delete "%key%" /f
reg add "%key% /f
reg add "%key%" /t REG_DWORD /v WIDTH /d %CURRENT_WIDTH% /f
reg add "%key%" /t REG_DWORD /v HEIGHT /d %CURRENT_HEIGHT% /f
我需要知道所有可能的解决方案,我只知道以下 ->
#640x480 -> "(res)WIDTH"=dword:00000280 "(res)HEIGHT"=dword:000001e0
#800x600 -> "(res)WIDTH"=dword:00000320 "(res)HEIGHT"=dword:00000258
#1024x768 -> "(res)WIDTH"=dword:00000400 "(res)HEIGHT"=dword:00000300
#1280×768 –> "(res)WIDTH"=dword:00000500 "(res)HEIGHT"=dword:00000300
#1280×800 –> "(res)WIDTH"=dword:00000500 "(res)HEIGHT"=dword:00000320
#1360×768 –> "(res)WIDTH"=dword:00000550 "(res)HEIGHT"=dword:00000300
#1440×900 –> "(res)WIDTH"=dword:000005A0 "(res)HEIGHT"=dword:00000384
好吧,我如何在本地窗口下获取“高度”和“宽度”的值,使用“批处理脚本”来确定当前分辨率???
有人可以帮我写脚本吗???