I'm trying to simplify my screenshot process on Windows 11. I created a batch file called "printscreen.bat" to use the NIRCMD tool to mimic the Print Screen function on my keyboard, since my keyboard doesn't have a Print Screen button. The contents of the batch file are as follows:
"c:\Users\USER\Documents\KEEP - Executables, Batchfiles, etc\nircmd\nircmd.exe" sendkeypress rwin+printscreen
It works perfectly when I double-click it, but when I try to run "printscreen" or "printscreen.bat" from the Run box, I get an error saying Windows can't find the file. I've already tried adding the full path to the Environment Variables as well as copying the batch file into the System32 folder, but nothing seems to work. Any ideas?
2 Answers
It sounds like a path issue! You should only add the directory of the batch file to your PATH variable, not the full file path. So, make sure you add just the folder:
C:UsersUSERDocumentsKEEP - Executables, Batchfiles, etcnircmd
Also, if you have any spaces in the folder names, you might need to put quotes around the full batch file path when you try to run it like this:
"C:UsersUSERDocumentsKEEP - Executables, Batchfiles, etcnircmdprintscreen.bat". Another thing to try is to restart the explorer.exe process after changing the PATH variable, just in case it's not recognizing the updates yet.
You're on the right track! Just a heads-up: in Windows, the Run box is a bit picky with batch files. It often does better with .exe or .cmd files. You can actually create a small .cmd launcher in a folder that's already in your PATH, like C:WindowsSystem32, which calls your batch file, or simply move your printscreen.bat to a different location that doesn’t have spaces in the path. Don't forget to restart your system or log out and back in after changing your PATH to make sure all updates take effect!
Related Questions
Can't Load PhpMyadmin On After Server Update
Redirect www to non-www in Apache Conf
How To Check If Your SSL Cert Is SHA 1
Windows TrackPad Gestures