118

Is there a one button way to save a screenshot directly to a file in Windows?


TheSoftwareJedi accurately answered above question for Windows 8 and 10. Below original extra material remains for posterity.

This is a very important question as the 316K views shows as of 2021. Asked in 2008, SO closed this question around 2015 as being off-topic, probably because of the last question below.

In Windows XP, one can press Alt-PrintScreen to copy an image of the active window, or Ctrl-PrintScreen to copy an image of the full desktop.

This can then be pasted into applications that accept images: Photoshop, Microsoft Word, etc.

I'm wondering: Is there a way to save the screenshot directly to a file? Do I really have to open an image program, like Paint.net or Photoshop, simply to paste an image, then save it?

Saj
  • 781
  • 8
  • 7
David Koelle
  • 20,726
  • 23
  • 93
  • 130
  • 14
    Photoshop?? Why not use mspaint or paint.net? Why use something as heavy as photoshop?? – GEOCHET Oct 01 '08 at 15:18
  • 1
    Best I got here was a screenshot of word with a screenshot of some error message directly pasted into an HTML mail. – VVS Oct 01 '08 at 15:23
  • Sorry if this is not really a contribution though I feel sorry that after all these years, Microsoft still hasn't implemented something Apple has for long time. The Mac saves the image by itself. No need to start an app first and paste. I mean for business use, time is money. I also use paint to paste but find that procedure quite cumbersome. Just had to ventilate my frustration here. Thanks for understanding guys. – Lawrence Jul 04 '13 at 09:49
  • @Lawrence let me vent a bit too.. I wouldnt say the process on Mac is any better, while the tail end is better, auto save and what not, the front of it, the command + shift + 3/4 is ultra arcane. *Linux*, imo, has the best of the lot, ironic since most of their features UI wise have been copied first from windows and now mac. For those who dont know, in Linux, you press print screen, type a name, save and move on. – Karthik T Dec 30 '13 at 13:25
  • 1
    Please take a look at my answer, it is FINALLY possible to do it atleast as easily as Mac (linux flow still better though) – Karthik T Dec 30 '13 at 13:35
  • 1
    Flagged for movement over to SuperUser. Although the accepted answer ended up being a programmatic one, as written, this question was looking for a general computer usage answer and so belongs on SuperUser. – ArtOfWarfare Aug 26 '14 at 12:11
  • "linux flow" when i press print on my linux nothing happens, i'll usually do ```sleep 5 && import screenshot.jpg```, but yeah, still much easier. But you guys are talking about Gnome or KDE features. – b1nary Jun 26 '15 at 11:17
  • 1
    Hi, maybe it's a little bit late for the answer but it can help others with a similar problem. There is an application in the Windows Store with which you can save a screenshot image from the clipboard to a temporary image on disk and return the path to the file, so you can use it with a simple ctrl + v in any application (https://www.microsoft.com/store/apps/9PM34S06CFVJ). You wouldn't need to open other software to save the screenshot to a file anymore. – Giovanni Esposito Feb 11 '19 at 19:05

20 Answers20

155

There is no way to save directly to a file without a 3rd party tool before Windows 8. Here are my personal favorite non-third party tool solutions.

For Windows 8 and later

Windows Key + PrintScreen saves the screenshot into a folder in <user>/Pictures/Screenshots

For Windows 7

In win 7 just use the snipping tool: Most easily accessed via pressing Start, then typing "sni" (enter). or Windows Key then sni enter

Prior versions of Windows

I use the following keyboard combination to capture, then save using mspaint. After you do it a couple times, it only takes 2-3 seconds:

  1. Alt+PrintScreen
  2. Win+R ("run")
  3. type "mspaint" enter
  4. Ctrl-V (paste)
  5. Ctrl-S (save)
  6. use file dialog
  7. Alt-F4 (close mspaint)

In addition, Cropper is great (and open source). It does rectangle capture to file or clipboard, and is of course free.

omerfarukdogan
  • 839
  • 9
  • 26
TheSoftwareJedi
  • 34,421
  • 21
  • 109
  • 151
  • 2
    Actually, this is surprisingly quick and easy. Also, if you're taking a series of shots, you can leave Paint open, and use Ctrl-N to keep resetting the paint area and Ctrl-S to save it (no need for Save as). Another advantage of keeping Paint open is that it remembers your choice of file format to save to (eg PNG). – Neil Mayhew Jul 27 '10 at 17:51
  • 1
    Thanks @Neil. I updated this answer with the Ctrl-S and new win 7 features. – TheSoftwareJedi Aug 06 '10 at 13:57
  • 1
    windows key + "sni" FTW! – Jason Jan 16 '14 at 02:35
  • Note that it works only for English locale. For Polish the tool is named Narzędzie Wycinanie and works analogically: `Win` then `w`, `y`, `enter`. – maciek Nov 26 '15 at 16:08
  • Doesn't work on the lock screen, so no good for capturing those cool windows backgrounds. Very much unlike on Android, which I can capture a screenshot of anything, anytime, including the lock screen. – Triynko Mar 10 '17 at 19:16
  • @Triynko (off-topic but....)Android screen capture doesn't work in all apps. Try doing one in a google play/netflix video or a DRM protected video, or in secure banking applications – Zoso Jun 03 '17 at 20:48
  • If a program is labeled as a game (Win+G) it saves the screenshot under: `C:/Users//Videos/Captures/` – phyatt Jun 28 '17 at 21:03
  • It would be great if we could use Alt + Windows Key + PrintScreen to capture just the active window, and save the image automatically to the screenshots folder. – viniciussss Mar 21 '18 at 12:33
  • some keyboards needs to press the Fn key along with the windows+PS keys – Amal Ps Dec 30 '19 at 04:43
51

You can code something pretty simple that will hook the PrintScreen and save the capture in a file.

Here is something to start to capture and save to a file. You will just need to hook the key "Print screen".

using System;
using System.Drawing;
using System.IO;
using System.Drawing.Imaging;
using System.Runtime.InteropServices;
public class CaptureScreen
{

    static public void Main(string[] args)
    {

        try
        {
            Bitmap capture = CaptureScreen.GetDesktopImage();
            string file = Path.Combine(Environment.CurrentDirectory, "screen.gif");
            ImageFormat format = ImageFormat.Gif;
            capture.Save(file, format);
        }
        catch (Exception e)
        {
            Console.WriteLine(e);
        }

    }

    public static Bitmap GetDesktopImage()
    {
        WIN32_API.SIZE size;

        IntPtr  hDC = WIN32_API.GetDC(WIN32_API.GetDesktopWindow()); 
        IntPtr hMemDC = WIN32_API.CreateCompatibleDC(hDC);

        size.cx = WIN32_API.GetSystemMetrics(WIN32_API.SM_CXSCREEN);
        size.cy = WIN32_API.GetSystemMetrics(WIN32_API.SM_CYSCREEN);

        m_HBitmap = WIN32_API.CreateCompatibleBitmap(hDC, size.cx, size.cy);

        if (m_HBitmap!=IntPtr.Zero)
        {
            IntPtr hOld = (IntPtr) WIN32_API.SelectObject(hMemDC, m_HBitmap);
            WIN32_API.BitBlt(hMemDC, 0, 0,size.cx,size.cy, hDC, 0, 0, WIN32_API.SRCCOPY);
            WIN32_API.SelectObject(hMemDC, hOld);
            WIN32_API.DeleteDC(hMemDC);
            WIN32_API.ReleaseDC(WIN32_API.GetDesktopWindow(), hDC);
            return System.Drawing.Image.FromHbitmap(m_HBitmap); 
        }
        return null;
    }

    protected static IntPtr m_HBitmap;
}

public class WIN32_API
{
    public struct SIZE
    {
        public int cx;
        public int cy;
    }
    public  const int SRCCOPY = 13369376;
    public  const int SM_CXSCREEN=0;
    public  const int SM_CYSCREEN=1;

    [DllImport("gdi32.dll",EntryPoint="DeleteDC")]
    public static extern IntPtr DeleteDC(IntPtr hDc);

    [DllImport("gdi32.dll",EntryPoint="DeleteObject")]
    public static extern IntPtr DeleteObject(IntPtr hDc);

    [DllImport("gdi32.dll",EntryPoint="BitBlt")]
    public static extern bool BitBlt(IntPtr hdcDest,int xDest,int yDest,int wDest,int hDest,IntPtr hdcSource,int xSrc,int ySrc,int RasterOp);

    [DllImport ("gdi32.dll",EntryPoint="CreateCompatibleBitmap")]
    public static extern IntPtr CreateCompatibleBitmap(IntPtr hdc,  int nWidth, int nHeight);

    [DllImport ("gdi32.dll",EntryPoint="CreateCompatibleDC")]
    public static extern IntPtr CreateCompatibleDC(IntPtr hdc);

    [DllImport ("gdi32.dll",EntryPoint="SelectObject")]
    public static extern IntPtr SelectObject(IntPtr hdc,IntPtr bmp);

    [DllImport("user32.dll", EntryPoint="GetDesktopWindow")]
    public static extern IntPtr GetDesktopWindow();

    [DllImport("user32.dll",EntryPoint="GetDC")]
    public static extern IntPtr GetDC(IntPtr ptr);

    [DllImport("user32.dll",EntryPoint="GetSystemMetrics")]
    public static extern int GetSystemMetrics(int abc);

    [DllImport("user32.dll",EntryPoint="GetWindowDC")]
    public static extern IntPtr GetWindowDC(Int32 ptr);

    [DllImport("user32.dll",EntryPoint="ReleaseDC")]
    public static extern IntPtr ReleaseDC(IntPtr hWnd,IntPtr hDc);
}

Update Here is the code to hook the PrintScreen (and other key) from C#:

Hook code

u8it
  • 3,956
  • 1
  • 20
  • 33
Patrick Desjardins
  • 136,852
  • 88
  • 292
  • 341
17

Little known fact: in most standard Windows (XP) dialogs, you can hit Ctrl+C to have a textual copy of the content of the dialog.
Example: open a file in Notepad, hit space, close the window, hit Ctrl+C on the Confirm Exit dialog, cancel, paste in Notepad the text of the dialog.
Unrelated to your direct question, but I though it would be nice to mention in this thread.

Beside, indeed, you need a third party software to do the screenshot, but you don't need to fire the big Photoshop for that. Something free and lightweight like IrfanWiew or XnView can do the job. I use MWSnap to copy arbitrary parts of the screen. I wrote a little AutoHotkey script calling GDI+ functions to do screenshots. Etc.

PhiLho
  • 40,535
  • 6
  • 96
  • 134
  • Just found this now. Thanks for that tip. – TankorSmash Jun 02 '12 at 20:47
  • Nice tip. Sometimes I am frustrated by error message dialogs that will not let me select text to copy. With this tip, many of them do! Try it in your browser here: https://jsfiddle.net/liamhennessy/cs3jsj6p/ – Liam Aug 10 '15 at 15:56
15

Thanks for all the source code and comments - thanks to that, I finally have an app that I wanted :)

I have compiled some of the examples, and both sources and executables can be found here:

http://sdaaubckp.svn.sourceforge.net/viewvc/sdaaubckp/xp-take-screenshot/

I use InterceptCaptureScreen.exe - simply run it in a command prompt terminal, and then press Insert when you want to capture a screenshot (timestamped filenames, png, in the same directory where the executable is); keys will be captured even if the terminal is not in focus.

(I use Insert key, since it should have an easier time propagating through, say, VNC than PrintScreen - which on my laptop requires that also Fn key is pressed, and that does not propagate through VNC. Of course, its easy to change what is the actual key used in the source code).

Hope this helps, Cheers!

sdaau
  • 36,975
  • 46
  • 198
  • 278
12

Very old post I realize, but windows finally realized how inane the process was.

In Windows 8.1 (verified, not working in windows 7 (tnx @bobobobo))

windows key + prnt screen saves the screenshot into a folder in <user>/Pictures/Screenshots

Source - http://windows.microsoft.com/en-in/windows/take-screen-capture-print-screen#take-screen-capture-print-screen=windows-8

Karthik T
  • 31,456
  • 5
  • 68
  • 87
6

Might I suggest WinSnap http://www.ntwind.com/software/winsnap/download-free-version.html. It provides an autosave option and capture the alt+printscreen and other key combinations to capture screen, windows, dialog, etc.

Jason
  • 243
  • 1
  • 7
4

Dropbox now provides the hook to do this automagically. If you get a free dropbox account and install the laptop app, when you press PrtScr Dropbox will give you the option of automatically storing all screenshots to your dropbox folder.

mwengler
  • 2,738
  • 1
  • 19
  • 32
  • This actually worked and i think is the fastest way to capture and save the screen. If it were my question, i would mark it as accept. – Muhammad Raheel Feb 12 '16 at 20:34
2

You need a 3rd party screen grab utility for that functionality in XP. I dig Scott Hanselman's extensive blogging about cool tools and usually look there for such a utility -- sure enough, he's blogged about a couple here.

Peter Meyer
  • 25,711
  • 1
  • 34
  • 53
2

This will do it in Delphi. Note the use of the BitBlt function, which is a Windows API call, not something specific to Delphi.

Edit: Added example usage

function TForm1.GetScreenShot(OnlyActiveWindow: boolean) : TBitmap;
var
  w,h : integer;
  DC : HDC;
  hWin : Cardinal;
  r : TRect;
begin
  //take a screenshot and return it as a TBitmap.
  //if they specify "OnlyActiveWindow", then restrict the screenshot to the
  //currently focused window (same as alt-prtscrn)
  //Otherwise, get a normal screenshot (same as prtscrn)
  Result := TBitmap.Create;
  if OnlyActiveWindow then begin
    hWin := GetForegroundWindow;
    dc := GetWindowDC(hWin);
    GetWindowRect(hWin,r);
    w := r.Right - r.Left;
    h := r.Bottom - r.Top;
  end  //if active window only
  else begin
    hWin := GetDesktopWindow;
    dc := GetDC(hWin);
    w := GetDeviceCaps(DC,HORZRES);
    h := GetDeviceCaps(DC,VERTRES);
  end;  //else entire desktop

  try
    Result.Width := w;
    Result.Height := h;
    BitBlt(Result.Canvas.Handle,0,0,Result.Width,Result.Height,DC,0,0,SRCCOPY);
  finally
    ReleaseDC(hWin, DC) ;
  end;  //try-finally
end;

procedure TForm1.btnSaveScreenshotClick(Sender: TObject);
var
  bmp : TBitmap;
  savdlg : TSaveDialog;
begin
  //take a screenshot, prompt for where to save it
  savdlg := TSaveDialog.Create(Self);
  bmp := GetScreenshot(False);
  try
    if savdlg.Execute then begin
      bmp.SaveToFile(savdlg.FileName);
    end;
  finally
    FreeAndNil(bmp);
    FreeAndNil(savdlg);
  end;  //try-finally
end;
JosephStyons
  • 57,317
  • 63
  • 160
  • 234
2

Try this: http://www.screenshot-utility.com/

From their homepage:

When you press a hotkey, it captures and saves a snapshot of your screen to a JPG, GIF or BMP file.

JosephStyons
  • 57,317
  • 63
  • 160
  • 234
1

Without installing a screenshot autosave utility, yes you do. There are several utilities you can find however folr doing this.

For example: http://www.screenshot-utility.com/

mattlant
  • 15,384
  • 4
  • 34
  • 44
1

Of course you could write a program that monitors the clipboard and displays an annoying SaveAs-dialog for every image in the clipboard ;-). I guess you can even find out if the last key pressed was PrintScreen to limit the number of false positives.

While I'm thinking about it.. you could also google for someone who already did exactly that.


EDIT: .. or just wait for someone to post the source here - as just happend :-)

VVS
  • 19,405
  • 5
  • 46
  • 65
1

Snagit...lots of tech folks use that.

pearcewg
  • 9,545
  • 21
  • 79
  • 125
1

Thanks to TheSoftwareJedi for providing useful information about snapping tool in Windows 7. Shortcut to open Snipping tool : Go to Start, type sni And you will find the name in the list "Snipping Tool"

enter image description here

Zahid Rouf
  • 1,611
  • 2
  • 12
  • 10
1

Keep Picasa running in the background, and simply click "Print Screen" key

Source

Abilash A
  • 951
  • 2
  • 8
  • 14
1

Short of installing a screen capture program, which I recommend, the best way to do this is by using the standard Print Screen method, then open Microsoft Office Picture Manager and simply paste the screenshot into the white area of the directory that you desire. It'll create a bitmap that you can edit or save-as a different format.

0

It turns out that Google Picasa (free) will do this for you now. If you have it open, when you hit it will save the screen shot to a file and load it into Picasa. In my experience, it works great!

Phoebe
  • 2,774
  • 3
  • 22
  • 27
0

As far as I know in XP, yes you must use some other app to actually save it.

Vista comes with the Snipping tool, that simplifies the process a bit!

Mitchel Sellers
  • 62,228
  • 14
  • 110
  • 173
0

You may want something like this: http://addons.mozilla.org/en-US/firefox/addon/5648

I think there is a version for IE and also with Explorer Integration. Pretty good software.

Nakilon
  • 34,866
  • 14
  • 107
  • 142
apandit
  • 3,304
  • 1
  • 26
  • 32
-6

Is this possible:

  1. Press Alt PrintScreen
  2. Open a folder
  3. Right click -> paste screenshot

Example:

Benchmark result window is open, take a screenshot. Open C:\Benchmarks Right click -> Paste screenshot A file named screenshot00x.jpg appears, with text screenshot00x selected. Type Overclock5

Thats it. No need to open anything. If you do not write anything, default name stays.

  • what windows version has a "paste screenshot" menu entry? (and with a clipboard content of type image there is no paste activated in win7). – eckes Oct 25 '12 at 21:12