How to remove "System File" attribute from a file without command prompt?
Is it possible to take away a file's "system" file attribute without using command prompt? Basically, I want to do this:
attrib "folder" -s
attrib "file" -s
without using command prompt, or a batch file. Windows explorer properties menu lets you do this for the hidden and read-only attributes, is there a way to do it with the system attribute?
If you want something you can do from the context menu, here's one way that might save you some time if you're trying to do this a lot:
Create a batch file RemoveSysAttrib.bat
@echo off
attrib -s "%1%"
Then follow this guide for adding a custom app to the context menu: How to Add Any Application to the Windows Desktop Right-Click Menu
You could then have a menu item called "Remove system attribute" which does just that, using your batch file. This way, you could also create a script to add the attribute back. Might be a bit fiddly getting it to work for multiple file selections, but with a bit of luck it will launch your file once for each selected item. You'll want to test this with:
@echo off
echo %1%
pause
If it supplies the file names as attribute 1, 2, 3, etc you'll have to loop over all parameters. If more than one parameter is supplied, you could invoke your script recursively like this:
if NOT "%2%"=="" (
for %%A in (%*) do (
RemoveSysAttrib.bat "%%A"
)
) else (
attrib -s "%1%"
)
Hope that helps =)
In response to Synetech's comments:
When you use
attrib
, it won’t change theH
orS
settings if the other is set (it will say not resetting XXXX file). You would need to strip (or set) both, then change the one that you did not want to modify back to what it was before.
I extended the script to check the 'H' attribute reported by Windows 7's attrib
command. To make it more generic, you would need to check more substring positions, as I have a hunch that it's different in other versions. I don't have other versions of Windows handy right now, so I can't check.
@echo off
setlocal enabledelayedexpansion
:: Check if file is hidden - works on Windows 7
set hidden=0
for /f "delims=" %%A in ('attrib "%1%"') do (
set attr=%%A
if "!attr:~4,1!"=="H" set hidden=1
)
:: If file is hidden, remove both attributes, then hide again.
if %hidden%==1 (
attrib -S -H "%1%"
attrib +H "%1%"
) else (
attrib -S "%1%"
)
endlocal
Install this: http://www.nirsoft.net/utils/bulkfilechanger.zip
or visit http://www.nirsoft.net/utils/bulk_file_changer.html to download the version file of your choice.
I found two more programs:
Attribute Changer - http://attribute-changer.software.informer.com/
File Attribute Stripper 1.0 - http://www.softpedia.com/get/System/File-Management/File-Attribute-Stripper.shtml
some time ago I was using "RemoveR PRO" from - http://www.bigwig.net/softwaredesign/free.htm (dead link now), maybe you can find it in some archives