Mark Bryant avatar image
Mark Bryant asked

Game Server StartMultiplayerServerCommand gets mangled

If you create a server using CreateBuildWithManagedContainer and specify

StartMultiplayerServerCommand to include a command line argument that contains dots (.), a space is inserted before the dot splitting the single command line argument into two arguments.

Steps to Reproduce

  1. Create a build of a Windows custom game server
  2. Invoke the CreateBuildWithManagedContainer API and set StartMultiplayerServerCommand to be something like the following:
C:\Assets\Server.exe -Argument=Alpha.Beta

3. Log in to a PlayFab VM for the newly created build and run powershell as administrator

4. Run the following command inside this powershell prompt:

Get-WmiObject Win32_Process -Filter "name = 'Server.exe'" | Select-Object CommandLine

Expected Result

C:\Assets\Server.exe -Argument=Alpha.Beta

Actual Result

C:\Assets\Server.exe  -Argument=Alpha .Beta


Place the command argument in single quotes when specifying StartMultiplayerServerCommand:

C:\Assets\Server.exe '-Argument=Alpha.Beta'


The PlayFab agent appears to run the following command for a managed container in docker:

powershell.exe ..\scripts\WindowsContainerStartupScript.ps1; "cmd /c C:\Assets\Server.exe -Argument=Alpha.Beta"

Powershell then mangles this when running cmd.exe:

"C:\Windows\system32\cmd.exe" /c C:\Assets\Server.exe -Argument=Alpha .Beta

cmd.exe then mangles this to the following command line:

C:\Assets\Server.exe  -Argument=Alpha .Beta

I was unable to find any documentation indicating that powershell then cmd.exe were used to run the custom game server executable and therefore didn't expect my command line arguments to be mangled. Would it be possible to escape the command line or at least document this unexpected behaviour?

Custom Game Servers
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Sarah Zhang avatar image Sarah Zhang commented ·

We will try to reproduce the issue and investigate it.

0 Likes 0 ·

1 Answer

Sarah Zhang avatar image
Sarah Zhang answered

Thanks for reporting it and sharing the corresponding workaround. We run the game server executables in Docker Containers with Powershell as the main entry point in the container. The issue can be reproduced locally on a Powershell prompt:

PS D:\> Write-Host -arg1=alpha.beta

-arg1=alpha .beta

The reason that causes this result is Powershell is treating everything after the ‘-‘ as a parameter flag and stops processing the flag once it sees the “.” hence the two things get separated by a space.

Fixing it on Playfab end has a risk of potentially affecting some existing customers’ start game commands, so we need time to assess. On the customer’s end, except for your workaround, the following command can work too.

C:\Assets\GameServer.exe --arg1=alpha.beta

It will take some time to update the documentation, so the forum is also part of the Playfab knowledge base, thank you for your participation.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

franklinchen avatar image franklinchen commented ·

Hi @Mark Bryant, thank you for reporting this. We have informed the product team and pushed the update in this documentation to clarify the format in the PS command line: The change will be deployed soon.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.