Delete file with command in .bat file

pachanga Posted messages 928 Status Member -  
Pierrot6150 Posted messages 3186 Status Member -
Hello,
I'm trying to test file deletion with a ".bat" file and it never works. I've followed instructions from two computer sites with various command options and it never works.

examples tried

del c:\test

or

del c:\test\*.*

or

"Here's how to create a Windows Batch File that deletes the contents of GIMP's thumbnail folder:

1. On your desktop, right-click and create a new Text Document.

2. Notepad will launch. Now insert the following line into notepad:

del C:\Users\Owner\.thumbnails\normal\*.* /Q

"

I know I need to replace some terms like the username or folder

if someone can guide me through this, it would be appreciated.
Thanks! :)

Configuration: ASUS P5QPL VM- INTEL E5400 2.7GHZ- DDR2RAM4GO- WINDOWS XP SP3 -GT220GEFORCE, Windows XP / Internet Explorer 8.0

1 answer

  1. jee pee Posted messages 31963 Registration date   Status Moderator Last intervention   10 009
     
    Hello,

    Which files do you want to delete?

    When you run the command, for example del c:\test\*.*, what error messages do you get? Do you have a C:\test directory that contains files to execute such a deletion command?

    Best regards

    --
    A stranger is a friend we haven't met yet.
    4
    1. pachanga Posted messages 928 Status Member 31
       
      I'm just doing tests, that's why I'm trying, for example, the file test.txt in the test folder in C/. So I'm trying
      del C/test/*.*
      or
      del C/test/

      Honestly, I don't know what it takes to work.
      I have no error messages.
      0
    2. kaumune Posted messages 22605 Registration date   Status Contributor Last intervention   5 160
       
      hi

      del c:\test\*.* (all files in the test directory) or del c:\test\test.txt (only the test.txt file)
      To avoid the confirmation prompt, add /q at the end (but you need to be sure of what you are deleting)
      0
    3. pachanga Posted messages 928 Status Member 31
       
      Thank you very much! I’ll try that right away :)
      0
    4. pachanga Posted messages 928 Status Member 31
       
      Yes, that works, maybe it was my capital C that was the problem...

      Thank you!!
      0
    5. Pierrot6150 Posted messages 3186 Status Member 561
       
      Uppercase or lowercase, Windows does not make a distinction.

      For your information:

      This example does not work, that's normal.
      del C/test/*.*
      or
      del C/test/

      The /
      is reserved to indicate to Windows that a parameter is being input in the command line.

      More info under the command prompt DEL /?
      * 1 space between DEL and /

      PS:
      You also need to specify the drive with a colon (missing from you) C:
      1