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

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


  2. Joined : May 2016
    127.0.0.1
    Posts : 232
    Windows 10
       21 Aug 2016 #2

    UP.
      My System SpecsSystem Spec


  3. Joined : Oct 2014
    Trnava
    Posts : 1,731
    Windows Home x64 (Home per choice)
       21 Aug 2016 #3

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

    Code:
    rmdir "%USERPROFILE%\Downloads" /s /q
    mkdir %USERPROFILE%\Downloads
      My System SpecsSystem Spec


  4. Joined : May 2016
    127.0.0.1
    Posts : 232
    Windows 10
       21 Aug 2016 #4

    And how would that work for the C:\ folder?
      My System SpecsSystem Spec


  5. Joined : Oct 2014
    Trnava
    Posts : 1,731
    Windows Home x64 (Home per choice)
       21 Aug 2016 #5

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


  6. Joined : May 2016
    127.0.0.1
    Posts : 232
    Windows 10
       21 Aug 2016 #6

    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 System SpecsSystem 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 22:53.
Find Us
Twitter Facebook Google+



Windows 10 Forums