4

For test automation purposes I am looking for a "command line" tool that takes screenshots. Until today I was satisfied with NirCmd, which can be used like

nircmd savescreenshot screen.png

Unfortunately this only takes the screenshot of monitor 1. Since multi-monitor setups become more and more common, I need an alternative that can handle multiple monitors.

The output should be similar to that copyied into the clipboard by Windows if you press PrintScreen, i.e. it should consider the screen layouts, not only create one file per monitor.

Other requirements

  • no dependencies if possible (.NET might be ok since it comes with Windows). The tool should be able to run on a fresh Windows installation.
  • No installation required. Impact on the system needs to be at a minimum.
  • gratis or open source, also for commercial use (so MiniCap does not qualify)
  • "command line", which means that it does not require user interaction. It should not open the black console window or any other window since this might disturb my automation task.
  • run on Windows 7 SP1 x64

I have tried:

1 Answer 1

2

You could use ImageMagick which fits most of your requirements with the command:

convert screenshot: screenshot.jpg
  1. The output should be similar to that copied into the clipboard by Windows if you press PrintScreen, i.e. it should consider the screen layouts, not only create one file per monitor. Not with the above command but the above command will produce 1 file per screen and you can chain it to the mosaic tools also in image magic to produce what you need - you will need to know your screen layout.
  2. no dependencies if possible (.NET might be ok since it comes with Windows). The tool should be able to run on a fresh Windows installation. ImageMagick has minimal dependencies and will run/install on a fresh install.
  3. No installation required. Impact on the system needs to be at a minimum. Single installation, minimum impact or there is also a portable distribution that does not require a full install.
  4. gratis or open source, also for commercial use (so MiniCap does not qualify) - Yes, both.
  5. "command line", which means that it does not require user interaction. It should not open the black console window or any other window since this might disturb my automation task. Since you specify no console window and command line I suspect that you mean callable from a batch file in which case Yes
  6. run on Windows 7 SP1 x64 Yes and Windows 8, 10, Linux, OS-X
2
  • Interesting that you answer this now. We started the development of such a tool by a student 2 weeks ago. Commented Sep 20, 2016 at 9:55
  • @Thomas - it might be that they can pick up some tricks from the imagemagick source then. Commented Sep 20, 2016 at 17:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.