Delete file with command in .bat file

pachanga Posted messages 928 Status Membre -  
Pierrot6150 Posted messages 3186 Status Membre -
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 réponse

jee pee Posted messages 31912 Registration date   Status Modérateur Last intervention   9 947
 
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
pachanga Posted messages 928 Status Membre 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
kaumune Posted messages 22694 Registration date   Status Contributeur Last intervention   5 156
 
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
pachanga Posted messages 928 Status Membre 31
 
Thank you very much! I’ll try that right away :)
0
pachanga Posted messages 928 Status Membre 31
 
Yes, that works, maybe it was my capital C that was the problem...

Thank you!!
0
Pierrot6150 Posted messages 3186 Status Membre 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