Closed Solved

How to delete a folder's content with CMD but leave it empty

Is there a way to delete a folders content but leave the empty folder when done?

I'm making myself a autohotkey script, here is what i got so far.

Run, C:\path\to\chrome.exe -incagnito
WinWait. - Google Chrome
WinWaitClose ; Wait for Google Chrome to close
Run, cmd /c "ipconfig /flushdns"


This is the folder i want to delete its contents.

%appdata%\Macromedia\Flash Player\#SharedObjects directory


Thanks :)
7 answers Last reply Best Answer
More about delete folder content leave empty
  1. Best answer
    cd %appdata%\Macromedia\Flash Player\#SharedObjects
    delete *.*
  2. Best answer selected by xX_PEMDAS_Xx.
  3. if you want to make the command quiet then I would recommend adding /Q before *.* which will remove the yes no prompt. You could also add /F to delete read only files and /S to delete all files in the subfolders
  4. caqde said:
    if you want to make the command quiet then I would recommend adding /Q before *.* which will remove the yes no prompt. You could also add /F to delete read only files and /S to delete all files in the subfolders


    very true... noone wants to deal with any of those stupid prompts...

    "Are you sure you want to delete win.exe?"

    YES THAT'S WHY I TYPED IT MAN DON'T QUESTION ME!!!!
  5. slhpss said:
    very true... noone wants to deal with any of those stupid prompts...

    "Are you sure you want to delete win.exe?"

    YES THAT'S WHY I TYPED IT MAN DON'T QUESTION ME!!!!



    ROFL ! XD
  6. Create an envar to that directory in sysdm.cpl
  7. This topic has been closed by Nikorr.
Ask a new question

Read More

Command Prompt Windows 7