1.    19 Aug 2016 #1
    Join Date : May 2016
    127.0.0.1
    Posts : 232
    Windows 10

    Batch script question


    Hello,

    I want make a batch script to delete a spefic folder on the C disk, but how can I get only that spefic folder? I got this:
    Code:
    FOR /D %%p IN ("C:\USERS\%USERNAME%\Downloads\*.*") DO rmdir "%%p" /s /q
    cd C:\USERS\%USERNAME%\Downloads\
    del *.* /q /s
    timeout /t 5 >nul 2>&1 /nobreak
    cls
    It works currently for the Downloads folder, but how can I change that?
      My ComputerSystem Spec
  2.    21 Aug 2016 #2
    Join Date : May 2016
    127.0.0.1
    Posts : 232
    Windows 10
    Thread Starter

    UP.
      My ComputerSystem Spec
  3.    21 Aug 2016 #3
    Join Date : Oct 2014
    Trnava
    Posts : 2,733
    Windows 10.4 Home 1709 x64

    That script looks so complicated, I prefer simple ones like:

    Code:
    rmdir "%USERPROFILE%\Downloads" /s /q
    mkdir %USERPROFILE%\Downloads
      My ComputerSystem Spec
  4.    21 Aug 2016 #4
    Join Date : May 2016
    127.0.0.1
    Posts : 232
    Windows 10
    Thread Starter

    And how would that work for the C:\ folder?
      My ComputerSystem Spec
  5.    21 Aug 2016 #5
    Join Date : Oct 2014
    Trnava
    Posts : 2,733
    Windows 10.4 Home 1709 x64

    %USERPROFILE% will choose the current user profile wherever it is located.

    If you want to specify a system disk, you can use %SystemDrive%

    A random folder would be:

    rd ""C:\AMD"" /s /q

    rd ""%SystemDrive%\AMD"" /s /q
      My ComputerSystem Spec
  6.    21 Aug 2016 #6
    Join Date : May 2016
    127.0.0.1
    Posts : 232
    Windows 10
    Thread Starter

    Code:
    FOR /D %%p IN (%SystemDrive%\Windows.old) DO rmdir "%%p" /s /q
    cd %SystemDrive%\Windows.old
    del *.* /q /s
    timeout /t 5 >nul 2>&1 /nobreak
    cls
    That?
      My ComputerSystem Spec

 


Similar Threads
Thread Forum
Batch File Help
I've never dabbled much in batch files, as I've usually been able to find pre-made ones to do what I wanted. We have an application that handles user data backups. It has three services, and at times, one or two of the three don't start...
Software and Apps
Solved Batch Append Mp3 Tags
Does anyone know of any software, or hack, or any other way that will allow me to batch append mp3 metadata tags to about 1000 mp3 files. There are 1000 songs, different titles, different artists, different genres. Lets say all of these are pop...
Software and Apps
Can't download batch file
Can't download batch file "10services_default.bat" to solve windows 10 start menu problem.
General Support
Solved Writhing Batch File
Here is my batch file but it will not delete the file? Must be missing something :( del "C:\Users\Larry\AppData\Local\TractorParts\tractor\ConfigSetting" Trying to delete the ConfigSetting File
General Support
Sub-script and Super-script
Is it possible to use sub-script and super-script when typing emails with Windows 10? I was able to do this when using Windows 7 and typing documents but not for emails. I was expecting that with the major up-grade to from 7 to 10 it would now be...
General Support
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd
All times are GMT -5. The time now is 21:23.
Find Us
Twitter Facebook Google+ Ten Forums iOS App Ten Forums Android App



Windows 10 Forums