Search code examples
command-promptdelete-fileappdata

Del command in command prompt


I want to, for example, delete a file in AppData/Roaming/MyFolder/myfile.txt.

I use command prompt and typed this: del %userprofile%/AppData/Roaming/MyFolder/myfile.txt

But then the command prompt said: Parameter format not correct - "ppData"

Then I think again and used %appdata% and typed:del %appdata%/MyFolder/myfile.txt

But the command prompt said: Invalid switch - "MyFolder"

How to delete myfile.txt using %userprofile% or %appdata%? Is my syntax wrong?


Solution

  • Use \ instead of / as the path separator:

    del %userprofile%\AppData\Roaming\MyFolder\myfile.txt