Results 1 to 4 of 4

Thread: Delete specified folders through windows CMD

  1. #1
    Join Date
    Apr 2009
    Posts
    79

    Delete specified folders through windows CMD

    Is there any programs that will erase all files in stored in a particular folder except those files which i have not mentioned in the program, I have little code to do please check and suggest whether it will do:

    Code:
    for /d %%a in (%1) do if /I not %%a == %2 rmdir /s /q %%a
    but am facing one problem when i execute this i delete all files which i have not suggested to do, does anyone know how to achieve this,by this we can set the workflow.

    Thanks in Advance

  2. #2
    Join Date
    Mar 2008
    Posts
    232

    Re: Delete specified folders through windows CMD

    Commands called in the [GuiRunOnce] section process synchronously. Each application runs in the order listed in this section, and each command must finish before you run the next command.

    Each line specifies a command that the [GuiRunOnce] registry entry executes, HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Runonce

    HKLM\...\RunOnceEx (ROE) waits for executions to finish, then HKLM\...\RunOnce starts and waits for executions, then HKLM\...\Run starts it's executions, then the desktop loads with the start of HKCU\...\RunOnce (GRO) executions along with the startup folders.

  3. #3
    Join Date
    Dec 2008
    Posts
    161

    Re: Delete specified folders through windows CMD

    You may run cleanup.cmd here i will provide you the code for CMD:

    Code:
    cmdow @ /HID
    psshutdown.exe -r -f -t 30 -c "Cleaning installation; XP will restart in 30 seconds..."
    
    net user aspnet /delete
    
    FOR %%? IN (log tmp) DO (DEL/A/S/F/Q "%SYSTEMROOT%\*.%%?")
    
    DEL "%AllUsersProfile%\Start Menu\Microsoft Update.lnk"
    DEL "%AllUsersProfile%\Start Menu\Programs\Internet Explorer.lnk"
    
    DEL "%UserProfile%\Start Menu\Programs\Internet Explorer.lnk
    
    DEL "%UserProfile%\Local Settings\Temp\*.*"
    
    RD /S /Q %UserProfile%\My Documents\
    
    RD /S /Q %AllUsersProfile%\Documents\
    
    RD /S /Q %systemdrive%\Install\
    RD /S /Q %systemdrive%\dot20\
    
    EXIT

  4. #4
    Join Date
    Feb 2009
    Posts
    53

    Re: Delete specified folders through windows CMD

    With Cmd.exe or with Command.com or by clicking Command Prompt - or some other way? Are you using the Dir command? With what switches? Have you dealt with any Attributes (Hidden,System)?

Similar Threads

  1. Windows 7: Unable to Delete documents or file folders
    By jpmlists in forum Windows Software
    Replies: 2
    Last Post: 30-08-2011, 08:47 PM
  2. Delete Folders in Windows Media Center library
    By longevity in forum Vista Help
    Replies: 2
    Last Post: 16-03-2011, 10:25 AM
  3. Replies: 3
    Last Post: 05-11-2008, 03:06 AM
  4. how to delete old profile folders
    By Duncan McC in forum Active Directory
    Replies: 2
    Last Post: 24-09-2008, 05:53 PM
  5. Can't delete folders or files
    By Robert in forum Vista Help
    Replies: 4
    Last Post: 28-04-2008, 01:55 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •