先上自己的码,临时文件一枚
1 2 3 4 5 |
@echo off echo Set oIE = CreateObject("htmlfile"):With oIE.parentWindow.screen:wsh.echo .width,.height:End With>%temp%\vbs.tmp for /f "tokens=1,2 delims= " %%a in ('cscript.exe //e:vbscript //nologo %temp%\vbs.tmp') do (set width=%%a&set height=%%b) echo 宽度:%width% ; 高度:%height% pause |
qsffsq,告知win7下可行
1 2 3 4 |
@echo off for /f "skip=1 tokens=1,2" %%a in ('wmic desktopmonitor get screenheight^,screenwidth') do echo 宽:%%b 高:%%a&&goto 1 :1 pause |
测试无果,本人win10.qsffsq又来一段,无临时文件,powershell 大牛所向,可惜有所延时
1 2 3 4 |
@echo off for /f "tokens=6,8 delims==,}" %%a in ('powershell -c "Add-Type -AssemblyName System.Windows.Forms;[System.Windows.Forms.Screen]::AllScreens"^|findstr "Bounds"') do (set width=%%a&set height=%%b) echo 宽度:%width% ; 高度:%height% pause |
话说,还有混编不是?冰柯堆码如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
@cc_on @if (0==0) @else @rem BAT 部分 @echo off cls setlocal set width= set height= for /f "tokens=1,2" %%a in ('cscript //nologo //e:jscript "%~dpnx0"') do (set width=%%a & set height=%%b) echo 宽度:%width% ; 高度:%height% pause goto :eof @end // JScript 部分 var screen = new ActiveXObject("HTMLFile").parentWindow.screen; WScript.Echo(screen.width + ' ' + screen.height); |
小学生表示,bat,JS玩成介样呢?虽然知道有混编,但重来没用过的说
发表回复