SetACL error

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Docfxit
Posts: 132
Joined: 12 Nov 2015 12:42

SetACL error

#1 Post by Docfxit » 12 Aug 2022 12:20

I have a batch file that I'm trying to create and I'm getting an error:
This is the error:

Code: Select all

C:\Batch>"C:\Batch\SetACL.exe" -on C:\Windows\system32\spool\Printers -ot file -actn ace "n:Gary;p:full"
ERROR in command line: No parameter found for option n:Gary;p:full!
This is the bat file:

Code: Select all

	net stop spooler
		@Echo off
		If not exist "%~d0\Batch\SetACL.exe" (
			cls
			Echo.
			Echo.
			Echo              %~d0Batch\SetACL.exe Not Found!!!
			Echo.
			Echo              Please get SetACL.exe and restart this file.
			Echo.
			Pause
			exit
			)
			@Echo On
			set folder=%WINDIR%\system32\spool\Printers
		"%~d0\Batch\SetACL.exe" -on %folder% -ot file -actn ace "n:%username%;p:full"
		del /F /q  %WINDIR%\system32\spool\PRINTERS\*.*
		net start spooler
pause		
Can someone please help fix this error?

Thank you,
Docfxit
Last edited by Docfxit on 12 Aug 2022 15:56, edited 1 time in total.

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: SetACL error

#2 Post by aGerman » 12 Aug 2022 14:26

The manpage states
[...] file or directory (file) [...]
There's no folder object type.

Steffen

Docfxit
Posts: 132
Joined: 12 Nov 2015 12:42

Re: SetACL error

#3 Post by Docfxit » 12 Aug 2022 15:59

Great catch. Thank you very much for pointing that out to me.

I have changed it from Folder to File.

I'm now getting a new error:

Code: Select all

C:\Batch>"C:\Batch\SetACL.exe" -on C:\Windows\system32\spool\Printers -ot file -actn ace "n:Gary;p:full"
ERROR in command line: No parameter found for option n:Gary;p:full!
I don't understand what parameter it's looking for.

Docfxit
Posts: 132
Joined: 12 Nov 2015 12:42

Re: SetACL error

#4 Post by Docfxit » 12 Aug 2022 16:20

I was able to get it to run but I don't understand why.
I had:

Code: Select all

SetACL.exe" -on %folder% -ot file -actn ace "n:%username%;p:full"
I added -ace:

Code: Select all

SetACL.exe" -on %folder% -ot file -actn ace -ace "n:%username%;p:full"
I have no idea what "-ace" means.
It does work now.

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: SetACL error

#5 Post by aGerman » 12 Aug 2022 17:09

Docfxit wrote:
12 Aug 2022 16:20
I have no idea what "-ace" means.
This is all perfectly explained. Read it as -parameterName value pairs.
-actn ace is parameter action with access control entry as the belonging value, telling SetACL what's to be updated.
-ace "n:%username%;p:full" is parameter access control entry with user name and kind of access to be granted as the belonging value.
This is just how the developer of the tool specified the syntax.

Steffen

Docfxit
Posts: 132
Joined: 12 Nov 2015 12:42

Re: SetACL error

#6 Post by Docfxit » 13 Aug 2022 17:43

Thank you very much for the explanation.

It's working great now.

Post Reply