Need help making a deleting .bat file


  1. Posts : 62
    Windows 7 Ultimate 32 bit OEM
       #1

    Need help making a deleting .bat file


    So basically i want a file i can click that deletes a whole folder
    At the moment i have this program
    HTML Code:
    @ Echo Off
    del c:/Users/Lewis/Desktop
    And that will delete my desktop.
    But the problem i have with this is when i click it i have to type Y or N to delete the files.
    As I'm going to use this as my shutdown command as-well i don't want to have to type Y or N so is there any way to bypass this?

    + Just released i spelt the title wrong! Sorry
      My Computer


  2. Posts : 6,830
    Windows 7 Ultimate 32-Bit & Windows 7 Ultimate 64-Bit
       #2

    Try using " /y " without the quotes at the end . That will choose yes you want to delete that file or folder
      My Computer


  3. Posts : 62
    Windows 7 Ultimate 32 bit OEM
    Thread Starter
       #3

    Nope sorry it didnt work. Now i have just incounterd a new problem. The .bat file wont delete the desktop now?
      My Computer


  4. Posts : 2,726
    Windows 7 Ultimate 64bit
       #4

    del c:\users\lewis\desktop /s /q that should work fine, this will delete all the files in the desktop folder but it will leave the desktop folder and it won't prompt you for confirmation

    If you want to remove the folder and all files within this folder then use

    rmdir c:\users\lewis\desktop /s /q
      My Computer


  5. Posts : 72,052
    64-bit Windows 11 Pro for Workstations
       #5

    Hello Lewis,

    If you wanted to delete all files in your Desktop folder instead of the folder, then you could use this below if you like. This way it will also work on any user account you run it in. :)

    Code:
    @echo off
    DEL /F /S /Q /A "%UserProfile%\Desktop\*"
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 17:55.
Find Us