Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question
add comment

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"

share|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
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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