Windows – Icacls works from command line, not from batch file

batch-fileicaclspermissionswindowswindows-server-2012

The OS is Windows server 2012.

I am trying to use command icacls C:\folder\targetfile /grant domain\usergroup:(rx) to give permissions on certain file.

The command works when executed on command line.

But when I run it from batch file I get the following error:

domain\usergroup: No mapping between account names and security IDs was done.
I am executing this command as domain admin. Domain admin has full control over target file and folder. Local admin works no better.
I also get same when trying to execute batch from Task Scheduler.

How can I make this work from batch file?

Best Answer

Comment by pgr pointed me to the right direction: The problem was caused by letter รถ in the name of the group.

If I change target group to one that has no nordic letters in its name it works fine.

Though I got the problem solved, it would still be nice to know if there is way to make batch file work with those characters.

EDIT: As pointed out in the comment, the command chcp 1252 before icacls solves the problem.