0

When running bat to add user to remote desktop users group from batch script

net localgroup "Użytkownicy pulpitu zdalnego" %user% /add 

got error cause on output got "U┐ytkownicy pulpitu zdalnego" as group name (diffrent encoding?) and that give error that group don't exist.

Please advise

Bart
  • 19
  • 4

2 Answers2

1

Solved

Save batch file as UTF-8 and change cmd codepage to UTF-8 with

chcp 65001
Bart
  • 19
  • 4
0

net.exe does not support names longer than 20 characters. http://support.microsoft.com/kb/324639

duenni
  • 2,959
  • 1
  • 23
  • 38
  • ok, so why it's work from comand line? btw that link you provide is valid for : Microsoft Windows Server 2003 R2 Standard Edition (32-bit x86) Microsoft Windows Server 2003 R2 Enterprise Edition (32-Bit x86) Microsoft Windows Server 2003, Standard Edition (32-bit x86) Microsoft Windows Server 2003, Enterprise Edition (32-bit x86) Microsoft Windows 2000 Professional Edition Microsoft Windows 2000 Server Microsoft Windows 2000 Advanced Server Microsoft Windows XP Home Edition Microsoft Windows XP Professional Microsoft Windows NT Workstation 4.0 Developer Edition not windows 7 – Bart Aug 05 '15 at 14:20
  • You did not specify what Windows version you are using. Does it work with a simpler group name? – duenni Aug 06 '15 at 05:59