3

For reference: this is a quick way to take a screenshot and have it saved in your Pictures folder (or elsewhere).

I would like to call it from a script if possible. Are there command line arguments? Can I change the output format from the default (Screenshot (XXX).png)?

3
  • Have you seen Win + Shift + S? It won't solve your issue (still only goes to the clipboard), but it's a fun and useful tool. Jun 1, 2018 at 21:55
  • There isn’t an executable. As far as I know it’s a kernel keyboard shortcut.
    – Ramhound
    Jun 1, 2018 at 22:20
  • Re "a quick way to take a screenshot and have it saved in your Pictures folder": It also wipes out the current content of the clipboard Mar 3 at 16:56

1 Answer 1

6

explorer.exe (Windows Explorer)

But it is not called, it already runs and if it captures the hotkey, it simply facilitates the action.

When you press Win+PrintScreen, then in Resource Monitor tool you can see that it is explorer.exe which saves screenshot file to its location. Moreover, if you exit explorer.exe using its Exit Explorer (hidden) menu command, this keyboard shortcut stops working.

Currently Explorer does not have any command line parameters to initiate the action.

But for example using PowerShell or NirCmd you can send the key combination using command line. Sequence of these 3 NirCmd calls works for me:

nircmd sendkey lwin down && nircmd sendkey printscreen press && nircmd sendkey lwin up

Oh, and when NirCmd made it into the answer, you can save the entire screenshot simply by its savescreenshot command:

nircmd savescreenshot d:\screenshot1.jpg

The above linked documentation says:

savescreenshot [filename] {x y width height}

save the screenshot of current screen into the specified image filename. The following file formats are supported: .bmp, .gif, .png, .jpg, .tiff You can also specify *clipboard* instead of real filename if you want to save the screenshot into the clipboard.

This command only works on Windows XP/2003/Vista (GDI+ is required)

You can also specify 4 optional parameters - x, y, width, and height, if you want to save only a part of the screen.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .