window通过命令行修改屏幕分辨率的方法

修改的方法是这样的

下载nircmd:

http://www.nirsoft.net/utils/nircmd.html

修改分辨率:

./nircmd.exe setdisplay 1280 720 32
./nircmd.exe setdisplay 1024 768 32
./nircmd.exe setdisplay 800 600 32

Changes your display settings. The [width] and [height] parameters represents the number of pixels on your screen. The [color bits] parameter represents the number of colors shown on your screen (8 - 256 color, 16 - 16bit color, 24 - 24bit color, and so on). {refresh rate} is an optional parameter that specifies the monitor refresh rate. If you specify the {-updatereg} parameter, the new settings will be saved in the Registry. If you specify both {-updatereg} and {-allusers} parameters, the new settings will be saved in the Registry for all users.
If you have multiple monitors, you can use the optional monitor parameter, which specifies for which monitor you want to change the display settings. You can specify the monitor by index (0 for the first monitor, 1 for the second one, and so on) or by specifying a string in the system monitor name. The monitor name can be found in the Device manager of Windows: Right click on the monitor item, and then choose ‘Properties’. The string displayed in the ‘location’ field is the monitor name.
Example:

setdisplay 800 600 24 -updatereg
setdisplay 1024 768 24 90
setdisplay 1024 768 8
setdisplay monitor:1 1024 768 24 90
setdisplay monitor:name1 1024 768 24 90

nircmd的功能还是非常强大,键盘输入也可以模拟

https://nircmd.nirsoft.net/sendkeypress.html
https://nircmd.nirsoft.net/sendkey.html

NirCmd Command Reference - sendkeypress
sendkeypress [Keys Combination 1] [Keys Combination 2] [Keys Combination 3] …
Sends one or more key press combinations to the system. The operating system will behave exactly as the user really pressed the specified keys combination.
The [Key Combination] parameter specifies a single key press to send or a combination of a single key and shift/ctrl/alt/Windows keys, delimited by ‘+’ character.
The key in the [Key Combination] parameter can be specifed as numeric virtual key code (For example: 0x2e for Delete key), or as one of the following predefined values: a - z and 0 - 9 (for alphanumeric keys), F1 - F24 (for Fxx keys), shift, ctrl, alt, enter, esc ,leftshift, rightshift, leftctrl, rightctrl, leftmenu, rightmenu, spc (space), down, up, left, right, home, end, insert, delete, plus, comma, minus, period, lwin, rwin (Windows key), apps, pageup, pagedown, tab, multiply, add, subtract, seperator, divide, backspace, pause, capslock, numlock, scroll, printscreen.
You can specify more than one [Key Combination] in a single sendkeypress command.

Here’s some examples for using sendkeypress:

Send ctrl+shift+esc to show the task manager of Windows:
sendkeypress ctrl+shift+esc
Send ctrl+shift+esc to show the task manager of Windows and then move to the next window with alt+tab:
sendkeypress ctrl+shift+esc alt+tab
Switch the capslock mode:
sendkeypress capslock
Print ‘Nir Sofer’ to the current text editor in focus (The shift key combination is used to get the capital letters):
sendkeypress Shift+n i r spc shift+s o f e r
Save the current screen image into the clipboard (Ctrl+PrintScreen):
sendkeypress Ctrl+printscreen
Send Ctrl+Shift+K and then Ctrl+Shift+A and then Alt+Shift+P:
sendkeypress ctrl+shift+k ctrl+shift+a alt+shift+p

NirCmd Command Reference - sendkey
sendkey [Key] [press | down | up]
Sends a keystroke to the system. The operating system will behave exactly as the user really pressed the specified keys.
The [Key] parameter specifies the key as virtual key code (For example: 0x2e for Delete key), or as one of the following predefined values: a - z and 0 - 9 (for alphanumeric keys), F1 - F24 (for Fxx keys), shift, ctrl, alt, enter, esc ,leftshift, rightshift, leftctrl, rightctrl, leftmenu, rightmenu, spc (space), down, up, left, right, home, end, insert, delete, plus, comma, minus, period, lwin, rwin (Windows key), apps, pageup, pagedown, tab, multiply, add, subtract, seperator, divide, backspace, pause, capslock, numlock, scroll, printscreen.
The second parameter specifies the key action: ‘press’, ‘down’, or ‘up’. For each key down action, you should also add the appropriate key up action.
In the following script example, the system behaves like the user presses Shift+Ctrl+Esc (the task manager should appear):
sendkey shift down
sendkey ctrl down
sendkey esc down
sendkey shift up
sendkey ctrl up
sendkey esc up

More examples:
sendkey a press
sendkey f10 press
sendkey enter press
sendkey 0x2e press

鼠标输入也可以模拟

https://nircmd.nirsoft.net/sendmouse.html
https://nircmd.nirsoft.net/movecursor.html

NirCmd Command Reference - sendmouse
sendmouse [right | left | middle] [down | up | click | dblclick]
sendmouse [move] [x] [y]
sendmouse [wheel] [Wheel Value]
Sends the specified mouse event to the system. The operating system will behave exactly as the user really made the specified mouse action.
Heres some example of sendmouse command:
Sent a right click (For most applications, a context menu is opened):
sendmouse right click
Sent a double-click with the left mouse button:
sendmouse left dblclick
Press the left mouse button, move the mouse cursor 20 pixels left and 30 pixels down, and then release the button:
sendmouse left down
sendmouse move -30 20
sendmouse left up
Scroll the mouse wheel 10 units in standard wheel mouse. (On standard wheel mouse, the wheel value should be a multiple of 120).
sendmouse wheel 1200

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值