Jump to content

how to make folders attribute system by batch file


Recommended Posts

hello dear friends :)

i need a simple batch command that makes the attributes of the folders inside a folder as system but i cant

do it since the folder dont have an extension. it must be something like "attrib +s *.folder" :) i know its

funny but this is all i can suggest :)

can you help me please ?

Link to comment
Share on other sites


The 'attrib' cmd command supports defining a folder-name as target, but then wildcards isn't supported.

Also, there's switches for enabling recursiveness(/s) and for enabling the processing of folders additionally(/d).

Link to comment
Share on other sites

Well, i've created such a batch as below a long time ago and i've been using this since then. (I believe i've edited some else package to be like this. Which? I don't recall)

I've removed some entries in order to make it a demo. I use this to remove read only attribute from folders i want. You can basically change the -R key to +S and edit the necessarry sections as you wish.

cWnd /HIDE @

cls

@echo off

goto top

Attrib1.bat

Program Files'da bulunan dosyalardaki "Salt Okunur" özelliğini kaldırır.

Nomadturk

:top

set name=top

if not %1()==() goto partial

attrib -R "%systemdrive%\program files\AIMP2\*.*" /S /D

goto top12

:top12

set name=top12

if not %1()==() goto partial

attrib -R "%systemdrive%\program files\Winrar\*.*" /S /D

goto top14

:top14

set name=top14

if not %1()==() goto partial

attrib -R "%systemdrive%\install\*.*" /S /D

goto end

:partial

set name=partial

attrib -R %1 /S /D

if %2()==() goto end

switch

:end

set name=end

exit

This one, is recursive.

Link to comment
Share on other sites

you can use the /d switch

attrib /d /s +s c:\foldername\*.*

this will make all folders and files under c:\foldername +s

you can follow up with a attrib -s c:\foldername\*.* /s

this will remove s on only the files inside it

dunno if this was helpful at all since you probably dont want to mess with the files :)

Link to comment
Share on other sites

Well, mine is recursive. That's why it's many more lines. But i remember /d not working for me.

(:

Darksimoon, if all you need is to change the attributes of some known files, than you'ld better use just this code:

attrib +s X:\Path\filename1.ext

attrib +s X:\Path\filename2.ext

...

attrib +s X:\Path\filenameX.ext

If not, give the others a try.

Edited by nomadturk
Link to comment
Share on other sites

hello friends ;

thank you very much for your replies.

@ nomadturk i wanted to try your codes however it seemed to me a little complicated. yet thank you very much for your reply.

@KingAFW your solution worked for me and it's easy. thank you very much. Here are the lines i used;

attrib +s "D:\userxpsettings\Desktop\New Folder\*.* " /S /D

attrib -s "D:\userxpsettings\Desktop\New Folder\*.* " /S

1st line attributes all the FILES and FOLDERS +S and the 2nd line removes S attribute from FILES and the result is only the folders are +S attributed. :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...