Windows 7 Win 7 Batch file needed

Discussion in 'Programming and Scripting' started by derekaus, May 16, 2011.

  1. derekaus

    derekaus New Member

    Joined:
    May 16, 2011
    Messages:
    20
    Likes Received:
    0
    Hi
    Can someone help me with a batch file that will delete the files in the c:/program Data/microsoft/windows/DRM folder on a Win 7 PC?
    Thanks in advance.
    Derek
     
  2. kaos

    kaos Senior Member

    Joined:
    May 9, 2011
    Messages:
    1,747
    Likes Received:
    33
    hi

    copy the text below into notepad and rename to .bat


    @echo off
    cls
    del "c:/program Data/microsoft/windows/DRM" /F /Q /S
    cls
    echo Files have been deleted
    ping localhost -n 5 > nul
    exit

    this will delete any files within the DRM folder based on the fact the path is c:/program Data/microsoft/windows/DRM

    hope this helps
     
    1 person likes this.
  3. derekaus

    derekaus New Member

    Joined:
    May 16, 2011
    Messages:
    20
    Likes Received:
    0
    Hi
    Thank you for your reply.
    When I run the bat file the files in the c:\program data\microsoft\windows\DRM are still there, it doesn't delete them?
    I do have administrator rights on the PC so I am not sure what's up?
    Any ideas?
    Thanks again!
    Derek
     
  4. kaos

    kaos Senior Member

    Joined:
    May 9, 2011
    Messages:
    1,747
    Likes Received:
    33
    hi sorry for the delay

    i just finished work

    okidokies


    to delete the FULL contents of the DRM folder, including all files, all folders please use the following, i only just clicked on what the DRM folder is haha...

    slight amendments to the script :D

    @echo off
    cls
    del "C:\ProgramData\Microsoft\DRM\*.*" /Q /F /S
    rd "C:\ProgramData\Microsoft\DRM\" /S /Q
    cls
    echo Files have been deleted
    ping localhost -n 3 > nul
    exit




    this will completly delete all files, folders and the DRM folder itself... if you dnt want the DRM folder removing completly let me no
     
    #4 kaos, May 17, 2011
    Last edited: May 17, 2011
  5. derekaus

    derekaus New Member

    Joined:
    May 16, 2011
    Messages:
    20
    Likes Received:
    0
    Hi
    Sorry to be a pain, but I ran the new bat file and the files in the DRM folder are still there, it hasn't deleted them or the folder.

    I don't need the folder deleted, just all of the files in it.

    I really appreciate yourt time and effort and hope you don't mind helping me.

    Regards
    Derek
     
  6. kaos

    kaos Senior Member

    Joined:
    May 9, 2011
    Messages:
    1,747
    Likes Received:
    33
    What's the exact location of your drm files ?
     
  7. derekaus

    derekaus New Member

    Joined:
    May 16, 2011
    Messages:
    20
    Likes Received:
    0
    Hi

    They are in: c:/program Data/microsoft/windows/DRM

    Thanks
    Derek
     
  8. kaos

    kaos Senior Member

    Joined:
    May 9, 2011
    Messages:
    1,747
    Likes Received:
    33
    i copied th text from the foruim

    passted into notepad and renamed it to drm.bat

    clicked it

    the DRM folder and the files were deleted

    i would upload the file but im having problems with it
     
  9. kaos

    kaos Senior Member

    Joined:
    May 9, 2011
    Messages:
    1,747
    Likes Received:
    33
    Just thought u said u had admin privledges in windows 7 there is uac or user acount control, if u ar an admin then thts. Okbut since uac.stops any deletion of system files it asks u if this a proper request
    So

    Use the same text as above save it as .bat

    But right click and run as admin

    Let me no if it works
     
  10. derekaus

    derekaus New Member

    Joined:
    May 16, 2011
    Messages:
    20
    Likes Received:
    0
    I have right clicked and run the .bat as administrator and still no luck....the files are still in the DRM folder. I definatley have the admin rights on the PC so I am pretty sure that is not causing this to happen. As a matter of interest, are you running Win 7, and does it work on your PC? I have tried running it on a few other PC's too and it didn't work on them either. Any further help would be greatly appreciated. Derek
     
  11. kaos

    kaos Senior Member

    Joined:
    May 9, 2011
    Messages:
    1,747
    Likes Received:
    33
    hi

    yes im running windows 7

    the bat file script did work on my pc as the system paths are the same,

    the files were deleted


    have you selected the option to view hidden files and folders
     
  12. derekaus

    derekaus New Member

    Joined:
    May 16, 2011
    Messages:
    20
    Likes Received:
    0
    Yes I have selected that option and can see the files in the folder as a result. It's strange how it's working on your PC but none of mine, maybe I'll run a few more tests outside of my network with the script and see what happens.
     
  13. kaos

    kaos Senior Member

    Joined:
    May 9, 2011
    Messages:
    1,747
    Likes Received:
    33
    plan b

    try this

    @echo off
    cls
    del "C:\Program Data\Microsoft\DRM\*.*" /Q /F /S
    rd "C:\Program Data\Microsoft\DRM\" /S /Q
    ping localhost -n 5 > nul
    pause


    this has a space between program and data

    see what the box will say
    because the cls has been removed " clear screen" it will display any error message

    either

    syntax error
    unable to find file
    access denied
    etc etc etc

    let me no wat it says :)
     
  14. derekaus

    derekaus New Member

    Joined:
    May 16, 2011
    Messages:
    20
    Likes Received:
    0
    It says:

    File cannot be found - DRM
    0 files copied
    The system cannot find the file specified
    Press any key to quit
     
  15. derekaus

    derekaus New Member

    Joined:
    May 16, 2011
    Messages:
    20
    Likes Received:
    0
    I also noticed the path in the last script was different to the path of the folder I am trying to have the files deleted from.

    So I edited it to include the \Windows path that was missing in it, but still no luck. The message that was returned on running this version was 'The system cannot find the path specified'.

    Here's what I have changed it to:

    @echo off
    cls
    del "C:\Program Data\Microsoft\Windows\DRM\*.*" /Q /F /S
    rd "C:\Program Data\Microsoft\Windows\DRM\" /S /Q
    ping localhost -n 5 > nul
    pause
     
  16. kaos

    kaos Senior Member

    Joined:
    May 9, 2011
    Messages:
    1,747
    Likes Received:
    33
    @echo off
    cls
    del "C:\Program Data\Microsoft\Windows/DRM\*.*" /Q /F /S
    rd "C:\Program Data\Microsoft\windows/DRM" /S /Q
    ping localhost -n 5 > nul
    Pause

    You might have to goto the files through c: to get the path then tight click a file with the drm folder click.properties and that will give u the exact path

    Try the above one on this post . I have taken out a / after the drm
    And changed it to the path u said it might be

    The *.* deletes any file within a folder. So e.g .Txt . Jpg .
    Doc etc etc
    We will do it run make sure you right click.and run as admin
     
  17. derekaus

    derekaus New Member

    Joined:
    May 16, 2011
    Messages:
    20
    Likes Received:
    0
    Hi
    Okay, I have found the following works, but it actually deletes the DRM folder, not the files in it. The difference to the path is 'ProgramData' doesn;t have a space between the 2 words when you check the properties of the DRM folder.

    Can you make it delete just the files in the DRM folder knowing what this one below does?

    @echo off
    cls
    del "C:\ProgramData\Microsoft\Windows/DRM\*.*" /Q /F /S
    rd "C:\ProgramData\Microsoft\windows/DRM" /S /Q
    ping localhost -n 5 > nul
    Pause
     
  18. kaos

    kaos Senior Member

    Joined:
    May 9, 2011
    Messages:
    1,747
    Likes Received:
    33
    @echo off
    cls
    del "C:\ProgramData\Microsoft\Windows/DRM\*.*" /Q /F /S
    rd "C:\ProgramData\Microsoft\windows/DRM" /S /Q <-------------------------------- this has been removed
    ping localhost -n 5 > nul
    Pause
    __________________________________________________________

    @echo off
    cls
    del "C:\ProgramData\Microsoft\Windows/DRM\*.*" /Q /F /S
    ping localhost -n 5 > nul
    Pause

    ^^^^^^^^^^^^^^^USE THIS ONE ^^^^^^^^^^^^^^^^^^

    As you can see the file path has not changed in any way shape or form just one line removed.... the RD command is remove directory

    ive still kept the command to keep the box open to show if ther are any errors,
    if this works succesfully
    then we can add a couple of more to make it a little more clearer

    :D
     
  19. derekaus

    derekaus New Member

    Joined:
    May 16, 2011
    Messages:
    20
    Likes Received:
    0
    All good, thanks so much for all of your help!
     
  20. kaos

    kaos Senior Member

    Joined:
    May 9, 2011
    Messages:
    1,747
    Likes Received:
    33
    your welcome, let me no if you want any more batch files , also therere is a like button too if u like this forum

    -------------------------------------\ /
     

Share This Page

Loading...