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 wih a .bat file commands

13 Jun 2011   #11

Windows 7 Home Premium 32bit

Ok OK, i almost managed to work ;o

here is how it looks like now:

@echo off
xcopy /Y %userprofile%\Desktop\*.* %userprofile%\DesktopFiles\  /s /q /f

cd "%userprofile%\Desktop"
dir *.* /b -o:d | find /v "." > \dirs.txt
for /f "tokens=*" %%a in (\dirs.txt) do call :DelFiles "%%a"
del \dirs.txt
exit /b

:DelFiles %1
set Flag=0
if %1=="All Users" set Flag=1
if %1=="Administrator" set Flag=1
if %1=="CurentUser" set Flag=1
if "%Flag%"=="0" (
cd %1
attrib *.* -r /s
rem change rd %1 /s /q
rem for no confirmation
rd %1 /s
del %userprofile%\Desktop\*.* /s /q /f
the only issue is that every time when finds folder, now it keeps ask me or i do wanna delete this folder Y/N?

please tell me what to correct in this code to stop it ask me for Y/N and just pick Y automatically

My System SpecsSystem Spec
14 Jun 2011   #12

Windows 7 Home Premium 32bit

newermind, i figured out myself.. it works now like a charm. if anyone needs this desktop .bat for some reason, pm me
My System SpecsSystem Spec

 Need help wih a .bat file commands

Thread Tools

Similar help and support threads
Thread Forum
Correct DOS commands might help
I am, at the moment, in DOS as Administrator: X:\windows\system32\cmd.exe trying to resolve these problems: 1. No operating system 2. I have no Recovery disks because Viao does not supply them. I only have a a repair disk which does not solve the problem. 3. I formatted the...
Backup and Restore
Including some commands in an unatttend file
Hi Running the sysprep /generalize /oobe /reboot /unattend:c:\Unattend.xml command in Audit mode, how do I create an answer file that allows to: 1) include a partition in the system protection of Windows 7 SP1. 2) rename and put a password to the Administrator account. 3)...
Installation & Setup
Bat commands..
Okay im trying to make a mini-fool for my friend :D And i want to my friend donot see the bat file Is this the code to he cant see it? attrib +h %0 Thanks. - kuchiyo
General Discussion
.bat Help.. Is these commands safe?
I just got installed the Luna theme to windows.. But at a bat file it's trying to do that: ren %windir%\explorer.exe explorer.exe.bak move /y "Resources\x86\explorer.exe" %windir% taskkill /F /IM explorer.exe start %windir%\explorer.exe Is that safe to replace the explorer.exe with a...
Themes and Styles
Windows Run Commands
I certainly hope someone here can help me. It used to be that the commands I typed in the RUN window where there when I returned. Not so now, the window's completely blank, and I have to retype where I want to go or open every time. :cry: What must I do to make the programs hold? Duchess
General Discussion
Run commands remembered ?
Is there any way to get the Run box to remember commands ? For instance msconfig, regedit. Each time the Run command box is opened all previous entries are gone and it's blank. Small thing maybe, but when I'm constantly fiddling it saves typing.:rolleyes:
General Discussion

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 11:31.
Twitter Facebook Google+ Seven Forums iOS App Seven Forums Android App