Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Need help making a deleting .bat file

15 Mar 2013   #1
LewisHolcombe

Windows 7 Ultimate 32 bit OEM
 
 
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 System SpecsSystem Spec
.
15 Mar 2013   #2
VistaKing

Windows 7 Ultimate 32-Bit & Windows 7 Ultimate 64-Bit
 
 

Try using " /y " without the quotes at the end . That will choose yes you want to delete that file or folder
My System SpecsSystem Spec
15 Mar 2013   #3
LewisHolcombe

Windows 7 Ultimate 32 bit OEM
 
 

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

15 Mar 2013   #4
PooMan UK

Windows 7 Ultimate 64bit
 
 

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 System SpecsSystem Spec
15 Mar 2013   #5
Brink

64-bit Windows 10 Pro
 
 

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 System SpecsSystem Spec
Reply

 Need help making a deleting .bat file




Thread Tools




Similar help and support threads
Thread Forum
Help with deleting a file
This has sneaked onto my C drive and I want to get rid and it will not let me...see image. I think it is part of the Windows 10 upgrade which I do not want at this time...please help...TIA Dont worry I have sorted it :)
General Discussion
Need help deleting a non-existent file
I've got two files on my hard drive that I cannot get rid of. I deleted them at some point, but they left behind this "ghost" file that can't be deleted because the item cannot be found. When I go to properties, it says that the file type is "File (.)" and it opens with "Windows Shell Common Dll"....
General Discussion
Something (possibly MSE) keeps deleting my file
I want to download a very specific file (doesn't really matter what it is) and it keeps getting deleted off my computer as soon as I download it. And Microsoft Security Essentials automatically starts asking me to send them information about this file, which I am not keen to do. I am sure this...
System Security
Making a DVD out of a .vob File
So...I have a .wma Movie File and a Converted .vob Movie File. I want to put the vob File on a DVD that can be played on DVD Players. I did it before using Xilisoft DVD Creator, but that was TrialWare and has watermarks. I recently downloaded BurnAware, but has Audio_TS and Video_TS Folders. I...
Music, Pictures & Video
Making an iso file on a netbook
Hello everyone, I have a toshiba NB-205 netbook with Windows 7 starter pre-installed (I have no windows 7 installation disc in other words). I wanted to follow the instructions on this post over at gizmodo:...
Installation & Setup


Our Sites

Site Links

About Us

Find 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 02:59.
Twitter Facebook Google+