Sign in to follow this  
Followers 0
boyemillar

Use Variable in CACLS statement

4 posts in this topic

I would like to use a Variable in a CACLS (For changing file permissions) statement rather than typing the directory in.

$varname="c:\mydir"

RunWait(@ComSpec & ' /c CACLS $varname, /E /C /R "System"','',@sw_hide)

Just want to do this if possible for ease of reading the script as most of the rest of the script uses the variable name instead of the full path and it would make it easier to change the path in the future.

Any one know how to do it or if its possible...

Share this post


Link to post
Share on other sites



RunWait(@ComSpec & ' /c CACLS ' & $varname & ', /E /C /R "System"','',@sw_hide)

Share this post


Link to post
Share on other sites

RunWait(@ComSpec & ' /c CACLS ' & $varname & ', /E /C /R "System"','',@sw_hide)

Cheerz Richard,

I had to remove the comma just before the (/E) to get it to remove "System" from the permissions.

.

Share this post


Link to post
Share on other sites

I simply edited the line you provided.

Share this post


Link to post
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
Sign in to follow this  
Followers 0