English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

how do i make it so my batch file deletes a specific file without asking user permission?

2007-05-01 04:02:23 · 3 answers · asked by Anonymous in Computers & Internet Programming & Design

3 answers

By default, the DOS "del" command does not ask for user permission if you're deleting files without using global wildcards.

You can test this by changing into your temp directory and creating a file to delete. Let's call that "test.txt". In your batch file, a simple line of "del \temp\test.txt" will delete the file without asking for permission.

You can test deleting multiple files by creating test1.txt, test2.txt, test3.txt, etc. Then, in your batch file, a line of "del \temp\test.*" will delete all the files without asking for permission.

A third test, create some files in your temp dir and try a line of "del \temp\*.*" will ask "Are you sure (Y/N)?" because you're using a global wildcard. To get around that you would modify the line to read "del \temp\*.* /q" to delete files "quietly", meaning without asking for permission.

2007-05-03 14:11:35 · answer #1 · answered by Kevin 7 · 6 2

might want to you thoughts using software replace Pioneer to do the replace? that is quite ordinary than writing code. listed the following are steps to get rid of very last 'a' from each line: a million. ctrl-o open textual content document 2. ctrl-h open 'replace' communique * set 'replace unit' to 'Chars' * set 'replace scope' to 'Line' * fill 'search for for trend' get admission to to '(.*)a' * fill 'replace with pattrn' get admission to to '$a million' 3. click 'replace', performed! listed the following are all examples on replace Pioneer homepage:

2016-12-05 04:13:22 · answer #2 · answered by ? 4 · 0 0

create a text file named del.dat, right click and choose edit
paste the following code,

IF EXIST "C:\file.txt" (
DEL /F "C:\file.txt"
) ELSE (

)

this will not prompt you, but if you dont have permission(system file, or locked file) it will not delete (you will have to do a brute force program to kill a locked file).

2007-05-01 04:41:43 · answer #3 · answered by math guy 2 · 1 2

fedest.com, questions and answers