SetACL "gotcha"
I may well be teaching granny to suck eggs here but I have recently discovered that the painstakingly constructed work-around for a "gotcha" in SetACL was never required.
The "gotcha" in question is that a SetACL command which uses paths enclosed in quotes which also has a trailing backslash will fail. So, for example, this:
SETACL -on "C:\Program Files\test\" -ot file -actn ace -ace n:test;p:full
will fail. The problem is that most of us would pass in an MSI property as the object upon which SetACL should act and, as we know, properties which resolve to paths will have a trailing backslash. To add to the fun, most such paths will be beneath %ProgramFiles% and will thus contain a space.
To date, I have used a combination of Custom Actions which test for space and trailing backslash and act accordingly. All has been in vain. The simple expedient of "escaping" the trailing backslash with ANOTHER backslash solves the problem:
SETACL -on "C:\Program Files\test\\" -ot file -actn ace -ace n:test;p:full
KISS was hardly ever more appropriate.
The "gotcha" in question is that a SetACL command which uses paths enclosed in quotes which also has a trailing backslash will fail. So, for example, this:
SETACL -on "C:\Program Files\test\" -ot file -actn ace -ace n:test;p:full
will fail. The problem is that most of us would pass in an MSI property as the object upon which SetACL should act and, as we know, properties which resolve to paths will have a trailing backslash. To add to the fun, most such paths will be beneath %ProgramFiles% and will thus contain a space.
To date, I have used a combination of Custom Actions which test for space and trailing backslash and act accordingly. All has been in vain. The simple expedient of "escaping" the trailing backslash with ANOTHER backslash solves the problem:
SETACL -on "C:\Program Files\test\\" -ot file -actn ace -ace n:test;p:full
KISS was hardly ever more appropriate.
0 Comments
[ + ] Show comments
Answers (0)
Please log in to answer
Be the first to answer this question
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.