How do I delete symlinks from a Windows folder with a batch file/script?
2014-07
How do I delete all symlinks and only all symlinks from a folder with a batch file/script?
The folder is c:\wamp\www
, and this is what I've tried:
Content files delete.cmd
for /f "delims=" %%D in ("dir /a:l /s /b c:\wamp\www") do (
rmdir c:\wamp\www\%%D
)
But my code does not work.
For deleting symlinks to files you want to use del
In order to delete symlinks to directories, you would use rmdir
I want to delete a file (a .exe) from a folder, after a specified date, say 25/Feb/2010. How can I use scheduled tasks and batch files for this. I am not sure whether the code below work :
@ECHO OFF
CLS
CD c:\target_folder\
ECHO Y | DEL innocent.exe
Will it work? If not, what will?
And how to run it on or after a specified date? Another doubt is how to go about adding it to scheduled tasks? Will it work if I don't turn the system ON, on 25/FEB? My requirement is this, the file should be deleted after that date.
http://support.microsoft.com/kb/313565
Summary: Use the at [time] [command] command.
Example:
bat1.bat:
at 2400 25 bat2.bat
bat2.bat:
#Your code
These 2 .bat files will, every month on the 25th, run bat2.bat.