Windows 7 Script for change files permissions

adamquadmon

New Member
Hi, I've a problem with a software that create some files, those Child objects do not inherit permissions from their parent as expected.

To solve this issue I have to manually edit the parent permission and give to his childs the same permissions of the folder itself. The checkbox solud be: Replace all permissions for child objects with inheritable permissions derived from this object
(I use an italian version of seven, so I don't know how this label is in english)

I need to make a script that each x time (1 time a day) run this command.

What should I look for?
I can create a .bat or somthing like this and then shedule it.
Bud I've never did this before, and I don't know how to find the right command

any tips?
 
Hi
Id need the Full path of the location to the folder, What permission you are wanting , if its full access or deny access , ill wip you something up
 
Hi
Id need the Full path of the location to the folder, What permission you are wanting , if its full access or deny access , ill wip you something up

logged users should read the files
the path is C:\Danea\Archivi

if you can write a script I'd like to read it, and undrstand wat's up.

thanks a lot for help me. :redface:
 
your more than welcome.

are you wanting read only on the content after "C:\Danea\Archivi/(here)" or full access , read write etc?
 
ok these are based on the fact
READ + EXEC
READ
WRITE - DENY
SPECIAL PERMS -DENY

there is no point implying a read only command if not DENY commands arnt set, as you can still write to the files

here is the code used

Code:
@echo off
cls
title File Permissions

echo.
Echo Set File Permisions
echo.
echo Deny write + Read
echo (execute also included as mandatory)
echo.
Echo 1) Apply Read only
echo 2) Reset (Full Control)

set choice= 
set /p choice=Please select your option: 
IF NOT '%Choice%'=='' SET Choice=%Choice:~0,1%
if '%choice%'=='1' goto enab
if '%choice%'=='2' goto reset



:enab
cls
cacls "C:\Danea\Archivi/*.*" /p %username%:n
echo.
cacls "C:\Danea\Archivi/*.*" /e /g %username%:r
exit


pause

:reset 
cacls "C:\Danea\Archivi/*.*" /e /g %username%:f
pause

copy it into notepad

save it as "anythin you wnt ere".bat

i.e Permissions.bat
or
Fileperms.bat

wat ever
 
ok these are based on the fact
READ + EXEC
READ
WRITE - DENY
SPECIAL PERMS -DENY

there is no point implying a read only command if not DENY commands arnt set, as you can still write to the files

good!

I need to make this script run without any userinput, I should add it to a cron.

I changed it as that:

Code:
@echo offcls
title File Permissions


cls
cacls "C:\Danea Easyfatt\Archivi\Amodio - Allegati\Doc\*.*" /p "Authenticated Users":n
echo.
cacls "C:\Danea Easyfatt\Archivi\Amodio - Allegati\Doc\*.*" /e /g "Authenticated Users":r
exit

But when I run it, it ask for confirmation (Y/N)
 
It must have user input , The cacls command doesnt have a switch /y command for an auto answer
 
Sorted it for you, Took me some time HOWEVER this works

Code:
:enab
cls
echo y| cacls "C:\Danea\Archivi/*.*" /p %username%:n
echo.
echo y| cacls "C:\Danea\Archivi/*.*" /e /g %username%:r
exit


I Have piped the command into the initial command
 
Sorted it for you, Took me some time HOWEVER this works

Code:
:enab
cls
echo y| cacls "C:\Danea\Archivi/*.*" /p %username%:n
echo.
echo y| cacls "C:\Danea\Archivi/*.*" /e /g %username%:r
exit


I Have piped the command into the initial command

perfect!

thanks a lot!!!
 
your welcome


any more scripts or anything then let me no, we can create loads of different tasks from file hiding to locking etc
 
well depends on what you want to acheieve,what you want to show or act etc

id start basic, i would jump in the deep end creating mad stuff. start small... do something write text, then it clears

so basics would be

@echo off (always use this)
cls - clear screen
echo - echos text so to start would be
pause - waits , press any key to continue

@echo off
cls
echo hello
pause

the displays the word hello, and text after the echo
to create space would be

@echo off
cls
echo hello
echo.
echo how are you

this would be like
Code:
Hello

How are you
 
ok this is an example

Code:
@echo off
cls
color A 
set /p f=Files to be moved:
set /p d=Destination :
xcopy %f%" "%d%
pause

so F is basically an open variable meaning that F can be anything i.e a path in our example. the D as our second as our destionation.. once these are set we use the normal command xcopy then outputting what we first specificed which was f and d

you can drag a file onto the cmd window to auto populate the path but on the destination you have to make sure that the path endings with a /
e.g c:/program files/document.txt
to
c:/program files/test folder /
without that the file wont move
 
Back
Top