Windows Plex Server fails to run post-processing script. Appears to be due to Plex including script executable in path string

Plex fails to run any post-processing script on Windows Plex Server

Server Version#: 1.24.2.4973
Player Version#: 1.33.0.2444-a220eae4

For windows servers the default directory for scripts is

C:\Users\[username]\AppData\Local\Plex Media Server\Scripts\

Plex fails to run any .bat script I throw in to this directory though. WIth plex just reporting the script failed to run with exit code 1.

debug output indicates plex is attempting throwing in the PWD above + script name + input file path name.

While that seems right, what does not seem right is the entire command is surrounded with quotation marks.

eg. “C:\Users\[Username]\AppData\Local\Plex Media Server\Scripts\transcode.bat” “X:\Path\to\.grab\tvShow.ts”

If I straight copy and paste that into command prompt it fails with a parse error.

If instead I run…
C:\Users\[Username]\AppData\Local\“Plex Media Server”\Scripts\transcode.bat “X:\Path\to.grab\tvShow.ts”

The command completes succesfully.

Note that Windows Plex Server admins are unable to change the script directory whatsoever.

Question
Why is the Windows Plex Server encapsulating the post-processing script executable with quotation marks?

Because the [Username] part of the path name can contain spaces.

Yes, I get that. the following also will work

“C:\Users\[Username]\AppData\Local\Plex Media Server\Scripts\"transcode.bat

Everything in the path except for the executable can be a string. My question still stands.

Why is the Windows Plex Server encapsulating the post-processing script executable with quotation marks?