Delete system file command line
Saturday, February 27, 2010
Leave a Comment
We can't delete files having system attribute set using del command from command line. For example in the folder c:\dir I have a file convert.exe. Now if I try to delete it from command line
c:\dir>del convert.exe
Could Not Find c:\dir\convert.exe
c:\dir>
Could Not Find c:\dir\convert.exe
c:\dir>
But convert.exe is present in the directory c:\dir
If I do dir it shows empty folder.
c:\dir>dir
Volume in drive C has no label.
Volume Serial Number is C45C-FE6F
Directory of c:\dir
27-02-2010 15:25 .
27-02-2010 15:25 ..
0 File(s) 0 bytes
2 Dir(s) 27,060,707,328 bytes free
c:\dir>
Volume in drive C has no label.
Volume Serial Number is C45C-FE6F
Directory of c:\dir
27-02-2010 15:25
27-02-2010 15:25
0 File(s) 0 bytes
2 Dir(s) 27,060,707,328 bytes free
c:\dir>
As a solution, to remove system files from command line, we can use /A switch with del command. In the above example we can run the below command to delete convert.exe
del /A:S convert.exe
This works on all known versions of Windows OS, i.e Windows XP/2003, Windows Vista and Windows 7.
thank you very much