A Batch File to delete My Documents Content
Results 1 to 4 of 4

Thread: A Batch File to delete My Documents Content

  1. #1
    Join Date
    Oct 2000
    Location
    Sydney, Australia
    Posts
    61

    A Batch File to delete My Documents Content

    Hello,

    I would like to run a batch file in my Novell 4.11 login scripts to automatically delete all files in the My Documents folder.

    What would be the content of the batch file? Would it be something like this?

    c:
    cd "c:\my documents"
    del *.* < "Y" NULL

    I was told that I would need two files, one that would contain the del *.* function and another file that contains 'Y' in it (no quotes). This Y would be passed as a parameter to the calling batch file.

    I also don't want the command to appear on the screen when run.

    I would appreciate any advice.
    Thanks,
    Andrew

  2. #2
    Join Date
    Jul 2002
    Location
    London
    Posts
    113
    To stop the script apearing on the screen enter Echo Off.

    Del *.* /q will delete without asking for confirmation.

    If you think there are sub directories

    del *.* /s /q

  3. #3
    Join Date
    Feb 2000
    Location
    26.03°N 80.14°W
    Posts
    9,410
    In later versions of MS-DOS and in Windows 9x/Me, the following single command will do what you're after:
    • echo y|del "c:\my documents\*.*">nul
    If you wanted to delete everything in "C:\My Documents", including all subdirectories, the command would be:
    • deltree /y "c:\my documents\">nul
    If you wanted the "C:\My Documents" folder itself gone too the command would be:
    • deltree /y "c:\my documents">nul
    If you wanted to see the output from any one of those commands, simply leave off the trailing ">nul" (redirection to NUL).

    I highly recommend practicing with an "A:\My Documents" folder, (with subfolders and files in each) first, before using your command on drive "C:".
    Vernon Frazee, Microsoft MVP (Windows - Shell/User)

    Defenses Up!
    Tip: When prompted for a password, give an incorrect one first. A phishing site will accept it; a legitimate one won't.


    Inside Spyware: A Guide to Finding, Removing and Preventing Online Pests


    If you don't keep up with security fixes, your computer|network won't be yours for long.

  4. #4
    Join Date
    Oct 2000
    Location
    Sydney, Australia
    Posts
    61
    Thanks for the replies. I appreciate it. Andrew.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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