Share via

Command Prompt to delete a file

Anonymous
2012-08-20T15:50:01+00:00

In windows ex home edition. I want to delete a file in command prompt.

The command prompt already lists \doc and settings\user\desktop.

Do I just type the file name after desktop\      and hit enter?

The troublesome file does not have text or doc ending.

Thanks much

Windows for home | Previous Windows versions | Files, folders, and storage

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2012-08-20T16:08:06+00:00

With the command windows open and if the desired directory/folder appears after the prompy character, type

del <filename>     then press enter

where <filename is the name of the file to be deleted.

This command will fail if the file is set as read only.

To force deletion even if it set as read only

type

del /f <filename>    then press enter

Type

exit or mouse click on the red x to close the command window.

Tom Ferguson

Was this answer helpful?

2 people found this answer helpful.
0 comments No comments

Answer accepted by question author

LemP 74,945 Reputation points Volunteer Moderator
2012-08-20T16:02:01+00:00

The command is del.  Type del /? for an explanation of the options.

I assume that what you mean by the second line in your post is that you see something like the following:

C:\Documents and Settings\username\Desktop>

If that is what you see AND if the troublesome file is on your desktop, then just enter

     del troublesomefilename            {press Enter}

If the troublesome file is NOT on your desktop, then you'll have to specify its location for the delete command.  If the path to the file includes spaces, enclose the whole path in double quotes. For example:

C:\Documents and Settings\username\Desktop>  del "c:\Documents and Settings\username\My Documents\My special stuff\troublesomefilename"   {press Enter}

Was this answer helpful?

2 people found this answer helpful.
0 comments No comments

0 additional answers

Sort by: Most helpful