9

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?

6
  • Without using the command prompt? Not natively in Windows Explorer as far as I'm aware, but there should be plenty of other GUI programs and possibly even Explorer shell extensions that do it. What exactly do you want? A GUI program or something within Explorer?
    – Bob
    Apr 19, 2012 at 2:50
  • yeah, i want a way to do this faster than executing a batch file, or CMD each time
    – Oztaco
    Apr 19, 2012 at 2:52
  • @leaf68: is GUI faster than command line!! I'm afraid, most people won't agree to that!! :D Apr 19, 2012 at 4:34
  • @VineetMenon lol its not just speed, but a little bit laziness too :P
    – Oztaco
    Apr 19, 2012 at 5:12
  • @leaf68: yeah... that I agree... :P Apr 19, 2012 at 5:21

4 Answers 4

11

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 the H or S 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
5
  • Err, sorry for giving you a batch file solution, which you explicitly stated you don't want, but I think you meant that you just don't want to have to manually type stuff in. Using the context menu avoids this. =)
    – paddy
    Apr 19, 2012 at 4:30
  • ah thanks, i've been trying to find that exact article because i recently formatted my PC, and used that before :) ...yeah i just didnt want to retype it each time
    – Oztaco
    Apr 19, 2012 at 5:07
  • 1
    Aside from the console window showing, your idea won’t work at all if the file has the hidden attribute set. When you use attrib, it won’t change the H or S 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. This means using environment settings and/or temporary files.
    – Synetech
    Aug 19, 2013 at 14:25
  • Thanks @Synetech I have offered an extension to handle this. Perhaps to address the aesthetic issue of the command window briefly showing, you could use a shortcut with the "Run minimized" setting.
    – paddy
    Aug 19, 2013 at 22:27
  • Nice. (Isn’t it annoying how sometimes even slightly increasing a program can drastically complicate it? You can’t even use find for this since it prints the filename.)
    – Synetech
    Aug 20, 2013 at 0:09
1

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.

1
  • 3
    Welcome to Super User! Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference.
    – slm
    Aug 19, 2013 at 15:22
1

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

0
0

You can use the AttrMenu shell-extension that creates a context-menu entry for files and folders:

Screenshot of AttrMenu context-menu

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .