Need help making a deleting .bat file

LewisHolcombe

New member
Member
Local time
9:12 AM
Messages
62
So basically i want a file i can click that deletes a whole folder
At the moment i have this program
HTML:
@ 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 My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Custom
OS
Windows 7 Ultimate 32 bit OEM
CPU
i5 quad
Memory
4gb
Graphics Card(s)
550ti
Hard Drives
128gb SSD, 1x 1tb Hybrid, 3 x 4tb HHD
Try using " /y " without the quotes at the end . That will choose yes you want to delete that file or folder
 

My Computer My Computer

Computer Manufacturer/Model Number
Custom Built
OS
Windows 7 Ultimate 32-Bit & Windows 7 Ultimate 64-Bit
CPU
Intel Core i7 CPU 950 @ 3.07GHz
Motherboard
ASUS P6T DELUXE V2
Memory
OCZ 6GB (3 x 2GB) 240-Pin DDR3 SDRAM DDR3 1600 OCZ3X1600R2
Graphics Card(s)
ATI Radeon HD 5700 Series
Sound Card
OnBoard
Hard Drives
WD6400AACS-00M3B0 (640GB SATA )
PSU
CORSAIR 850w
Case
NZXT LEXA
Cooling
Intel Stock Heatsink Fan
Keyboard
Microsoft Wireless Laser Keyboard 7000
Mouse
Microsoft Wireless Laser Mouse 7000
Nope sorry it didnt work. Now i have just incounterd a new problem. The .bat file wont delete the desktop now?
 

My Computer My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Custom
OS
Windows 7 Ultimate 32 bit OEM
CPU
i5 quad
Memory
4gb
Graphics Card(s)
550ti
Hard Drives
128gb SSD, 1x 1tb Hybrid, 3 x 4tb HHD
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 My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Self Built
OS
Windows 7 Ultimate 64bit
CPU
AMD Phenom Quad core 9950 black edition
Motherboard
Gigabyte
Memory
16Gb
Graphics Card(s)
2x XFX Radeon 5850
Sound Card
PCI Express X-Fi Titanium / Logitech G35
Monitor(s) Displays
2x HP 2410i
Screen Resolution
1920x1080
Hard Drives
2x 500Gb Seagate
1x 300Gb Seagate
1x 1Tb Seagate
2x 1Tb Hitatchi
PSU
Jean Tech Storm 700W
Case
Cooler Master COSMOS S
Cooling
Akasa Evo Blue Pro
Keyboard
Logitech G15
Mouse
Mad Catz M.M.O. 7
Internet Speed
12mb
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 My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Self built custom
OS
64-bit Windows 11 Pro for Workstations
CPU
Intel i7-8700K OC'd to 5 GHz
Motherboard
ASUS ROG Maximus XI Formula Z390
Memory
64 GB (4x16GB) G.SKILL TridentZ RGB DDR4 3600 MHz
Graphics Card(s)
ASUS ROG-STRIX-GTX1080TI-O11G-GAMING
Sound Card
Integrated
Monitor(s) Displays
2 x Samsung Odyssey G7 27"
Screen Resolution
2560x1440
Hard Drives
1TB Samsung 990 PRO M.2,
4TB Samsung 990 PRO PRO M.2,
TerraMaster F8 SSD Plus NAS
PSU
Seasonic Prime Titanium 850W
Case
Thermaltake Core P3
Cooling
Corsair Hydro H115i
Keyboard
Logitech wireless K800
Mouse
Logitech MX Master 4
Internet Speed
2 Gb/s Download and 100 Mb/s Upload
Antivirus
Malwarebyte Anti-Malware Premium
Browser
Google Chrome
Other Info
Logitech Z625 speaker system,
Logitech BRIO 4K Pro webcam,
HP Color LaserJet Pro MFP M477fdn,
APC SMART-UPS RT 1000 XL - SURT1000XLI,
Galaxy S23 Plus phone
Back
Top