👨‍🏫 Tutorial AutoHotkey v2.0 | Auto-Save Screenshots in Windows (AHK + Batch File Guide)

Szy

Honorary Poster
This guide shows how to automatically save Win + Shift + S screenshots to a folder without manual pasting using AutoHotkey (AHK) and a Batch File.

Tools Used​

  1. Windows Snipping Tool (Win + Shift + S)​
  2. AutoHotkey v2.0 (for automating the process) → You do not have permission to view the full content of this post. Log in or register now.
  3. Batch File (CMD & PowerShell) (for handling file storage)​

How It Works​

✅ Press Win + Shift + S → Screenshot is copied to clipboard
✅ AHK script triggers the batch file
✅ Batch file creates a folder with today's date
✅ Screenshot is auto-saved inside that folder with sequential numbering



📂 Final Folder Structure Example:
Code:
C:\Users\Administrator\Pictures\Screenshots\
    ├── 2025-02-24\
    │   ├── screenshot1.png
    │   ├── screenshot2.png
    ├── 2025-02-25\
    │   ├── screenshot1.png



Step 1: Install AutoHotkey​

🔹 Download & Install AutoHotkey v2.0 from You do not have permission to view the full content of this post. Log in or register now.

Step 2: Create the AutoHotkey Script​

📌 Open Notepad and paste the following code:
Code:
#Requires AutoHotkey v2.0

#+s:: {
    ; Simulate pressing Win + Shift + S (to trigger Windows Snipping Tool)
    Send("#+s")
 
    Sleep(1000) ; Wait for clipboard to update

    ; Run batch script to save the screenshot
    Run("C:\Users\Administrator\Documents\Batch File\autosave_screenshot.bat", , "Hide")
}
📌 Save it as screenshot.ahk
📌 Run the script (Right-click → Run Script)

Step 3: Create the Batch File

📌 Open Notepad and paste the following code:
Code:
@echo off
setlocal enabledelayedexpansion

:: Define base screenshots folder (Auto-adjusts to current user's account)
set "baseFolder=C:\Users\%USERNAME%\Pictures\Screenshots"

:: Get today's date in YYYY-MM-DD format
for /f "tokens=2 delims==" %%I in ('"wmic os get localdatetime /value"') do set datetime=%%I
set "dateFolder=%baseFolder%\%datetime:~0,4%-%datetime:~4,2%-%datetime:~6,2%"

:: Ensure today's folder exists
if not exist "%dateFolder%" mkdir "%dateFolder%"

:: Auto-increment filename
set "count=1"
:check
if exist "%dateFolder%\screenshot!count!.png" (
    set /a count+=1
    goto check
)

:: Save clipboard image to next available file
powershell -command "Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.Clipboard]::GetImage().Save('%dateFolder%\screenshot!count!.png')"

echo Screenshot saved as %dateFolder%\screenshot!count!.png
📌 Save it as autosave_screenshot.bat
📌 Store it in: C:\Users\Administrator\Documents\Batch File\autosave_screenshot.bat

Step 4: Run the AHK Script

  1. Double-click screenshot.ahk to run the script
  2. Press Win + Shift + S → Screenshot will be automatically saved!



Final Result

Every time you take a screenshot (Win + Shift + S), it will:
✅ Create a folder per day 📂
✅ Save the screenshot automatically 🖼️
✅ Name it sequentially (screenshot1, screenshot2, etc.) 🔢

🛠 Troubleshooting

Screenshots aren’t saving?
✔ Check that the batch file path is correct in the AHK script
✔ Ensure AutoHotkey is running
✔ Manually run the batch file to see if it works

Want to change the save location?
✔ Edit baseFolder in the batch file

Done! No more manually pasting into Paint or other apps. Feel free to modify & improve the script.
 

About this Thread

  • 0
    Replies
  • 708
    Views
  • 1
    Participants
Last reply from:
Szy

Trending Topics

Online now

Members online
1,124
Guests online
3,375
Total visitors
4,499

Forum statistics

Threads
2,315,735
Posts
29,183,794
Members
1,182,688
Latest member
aamadou
Back
Top