I have a file in a given folder that I want to delete by either running a script or clicking on some shortcut, but I have no idea how to do so.

So if the file is in C:\Program Files\Our crappy software\file to be deleted.txt

How would I have to do this by preferably not using additional software like AutoHotKey and only on Windows systems.

link|improve this question

feedback

2 Answers

up vote 4 down vote accepted

Open up notepad and copy the following in to it:

Del C:\"Program Files"\"Our crappy software"\"file to be deleted.txt"

Save this as either a .cmd or .bat file.

Run it!

You can either double click or place a shortcut.

This will allow you to delete from anywhere, alternatively you can use:

Del "file to be deleted.txt"

as long as the working directory is correct, but it is best to use actual paths.

FYI - you do not need quotes for one word names, you just use them where there is a space, alternatively, you can use the old 8.3 file format (for example, go to command prompt and a directory with long files and type dir /x then you can use file~1 instead of "file to be deleted.txt"

link|improve this answer
Thanks I think that is exactly what I need, though I'm curious if anyone else will come up with something else – Ivo Flipse Dec 8 '09 at 11:03
feedback

if i am understanding the question correctly, you could write a batch script to solve your problem.

something along the lines of:

del "C:\Program Files\Our crappy software\file to be deleted.txt?" /< options>

or something similar.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.