DOS command - del command

DOS additions: Del command

deletes files

Example:

del e:\test.txt

delete e:\test.txt

The del command has several important parameters:

/P Prompt for confirmation before deleting each file.
/F Force deletion of read-only files.
/S Deletes the specified file in all subdirectories.
/Q Quiet mode. When deleting a global wildcard, no confirmation is required
/A Select the file to be deleted according to the attribute

Example:
If you want to delete all sun.txt in the E drive, and the file sun.txt is read-only, what should you do?

del /f /se:\sun.txt

Note: Because you need to search the entire C drive, you need to wait for a while.


What if you delete it in a normal way?

C:\Users\asus>del e:\test.txt
e:\test.txt
Access denied.


Example
@echo off
echo is cleaning system junk files, please wait...
del /s /f /q %systemdrive%\*.tmp >nul 2>nul
del /s /f /q %systemdrive%\*.gid >nul 2>nul
del /s /f /q %systemdrive%\*.chk >nul 2>nul
. So what are they, these are actually system variables, which is just another representation of the system directory. We can use "echo %userprofile%" to see which directory in the system it represents. Then the other is the same meaning *.tmp














It means that this * sign is a wildcard symbol, which means all files with .tmp extension

>nul 2>nul means to mask all the information or errors when the command is executed

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326980012&siteId=291194637