Make A Batch File That Deletes Files

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • anoble1
    New Member
    • Jul 2008
    • 246

    Make A Batch File That Deletes Files

    Hi,

    Not sure if many can help but I am in IT, and run in to a certain program error all the time. The fix is deleting 4 files in their PC.

    Example:
    1.Delete the UCF folder located at C:\Documents and Settings\Userna me\Documentum
    2.Delete the Java folder located at C:\Cache

    3.Delete Temp internet Files
    4.Delete Cookies

    Any suggestions?
  • zmbd
    Recognized Expert Moderator Expert
    • Mar 2012
    • 5501

    #2
    Hello,
    Wow, an batch file... I remember when these were the only way to fly in the old DOS-1.0/3.0 days.
    But I show my age ;)

    Anyway, this is one of a few references available to the old notepad basher: http://www.computerhope.com/batch.htm I go with the tutorial in that batch files are not taught anymore and some (like myself) haven't used one in so long...

    There are also other scripting languages and power-shell and the like; however, if as my I.T. does, the corperate types have some of these disabled. However, if you have the correct access rights, these old DOS batch files will work!

    Comment

    • anoble1
      New Member
      • Jul 2008
      • 246

      #3
      Nice, couldn't figure out how to do the "Username" thing. Cause everyone's username is different.

      Comment

      • zmbd
        Recognized Expert Moderator Expert
        • Mar 2012
        • 5501

        #4
        Oh, I should mention that "edit" more than likely isn't usually included in some if the newer versions of windows so you will have to use something else like notepad... just make sure to save the file with the "bat" extention.

        Comment

        • unrauew
          New Member
          • Nov 2012
          • 1

          #5
          Create a text file, name it and change the extension to .bat

          If you open a cmd prompt and type in "help" it will list all the acceptable commands.

          use del or erase for files and rmdir for directories.

          If you are unsure of the usage of a particular command, at the command prompt, type in the command followed by /? i.e. del /? will give you proper usage of del.

          On the .bat file you created earlier, right click and select edit. Enter the commands and switches that you want to run, save it, then run it by double clicking the file.

          The user folder can be accessed as %userprofile% so to remove the folder UCF, you would use RMDIR "%userprofile%\ documentum\UCF" .

          I would definitely test this before putting it into production. :-)

          Comment

          • zmbd
            Recognized Expert Moderator Expert
            • Mar 2012
            • 5501

            #6
            unrauew:
            What information did you provide that was not already provided in my post and in the provided tutorial?

            Also %userprofile% although should be a universal environment for the local drive ("C:") is not guaranteed to work at the PC level... In fact, if you type that shortcut into a windows explorer on my work pc you will be taken to the roaming profile folder share on the server - not the "c:\....\userna me\" on the local pc!

            Comment

            Working...