anyone know how to make a batch file or script or some other simple thing like a shortcut that calls some exe to do the following:
I want to click on something (batch file, script or shortcut) that will delete the last file in a specified folder.. only the last (most recent) file.
Why would I want to do this?
Sometimes I accidentally take a "wrong" screenshot. I would like to be able to delete it quickly.
Answer
Batch file:
@echo off
pushd "c:\yourPath"
for /f "eol=: delims=" %%F in ('dir /b /a-d /o-d') do (
del "%%F"
exit /b
)
Command line (no batch script) that could be included directly in a shortcut.
cmd /c pushd "c:\yourPath"&for /f "eol=: delims=" %F in ('dir /b /a-d /o-d') do @(del "%F"&exit)"
No comments:
Post a Comment