# \[Solved\] PostProcessing Script, Can't Call wsl.exe from Batch File

**URL:** <https://forums.plex.tv/t/solved-postprocessing-script-cant-call-wsl-exe-from-batch-file/773492>\
**Category:** Live TV & DVR\
**Tags:** livetv-dvr, server-windows\
**Created:** [January 29, 2022, 2:22am UTC](https://forums.plex.tv/t/solved-postprocessing-script-cant-call-wsl-exe-from-batch-file/773492 "2022-01-29T02:22:52Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![rmorris](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/rmorris/32/13669_2.png) [@rmorris](https://forums.plex.tv/u/rmorris)\
**Post date:** [January 29, 2022, 2:22am UTC](https://forums.plex.tv/t/solved-postprocessing-script-cant-call-wsl-exe-from-batch-file/773492/1 "2022-01-29T02:22:52Z")

</div>

Server Version#: 1.25.4.5468

OK, pulling my hair out with this one ☹. I have a post processing script that I’m happy with - it was written in Linux, works in bash. I have tried it in WSL (Windows Subsystem for Linux), works great as well. And, I have a batch file that calls it (using wsl.exe) … also works fine.

The only step that breaks (of course … LOL!) is when Plex calls my batch file. It starts the batch, that I have confirmed, but the command to call wsl.exe fails. Again, only from Plex, not running the batch file from CMD or PowerShell - they both are find.

Anyone seen anything similar? Any pointers?

Thanks!

---

<div class="post-metadata">

**Author:** ![nwsurfer](https://avatars.discourse-cdn.com/v4/letter/n/e9c0ed/32.png) [@nwsurfer](https://forums.plex.tv/u/nwsurfer)\
**Post date:** [January 29, 2022, 3:37pm UTC](https://forums.plex.tv/t/solved-postprocessing-script-cant-call-wsl-exe-from-batch-file/773492/2 "2022-01-29T15:37:35Z")

</div>

I’m not an expert by any means so I apologize if you have already thought about this. Does Plex have the correct permissions to run .exe?

---

<div class="post-metadata">

**Author:** ![rmorris](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/rmorris/32/13669_2.png) [@rmorris](https://forums.plex.tv/u/rmorris)\
**Post date:** [January 29, 2022, 4:11pm UTC](https://forums.plex.tv/t/solved-postprocessing-script-cant-call-wsl-exe-from-batch-file/773492/3 "2022-01-29T16:11:44Z")

</div>

You may be right! I am logging to a file now, and there is just no output at all from wsl.exe - tried the full path as well. Not even an error message, just no output. Kinda stumped - not sure what the issue is, and hard to tell with no error / output.

Thinking that under Windows it should be running as “me”, no?

Thanks!

---

<div class="post-metadata">

**Author:** ![rmorris](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/rmorris/32/13669_2.png) [@rmorris](https://forums.plex.tv/u/rmorris)\
**Post date:** [January 29, 2022, 4:13pm UTC](https://forums.plex.tv/t/solved-postprocessing-script-cant-call-wsl-exe-from-batch-file/773492/4 "2022-01-29T16:13:20Z")

</div>

OK, just checked - it is in fact running as me. Very odd. Wondering now if wsl.exe won’t run from a script?

---

<div class="post-metadata">

**Author:** ![rmorris](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/rmorris/32/13669_2.png) [@rmorris](https://forums.plex.tv/u/rmorris)\
**Post date:** [January 29, 2022, 5:05pm UTC](https://forums.plex.tv/t/solved-postprocessing-script-cant-call-wsl-exe-from-batch-file/773492/5 "2022-01-29T17:05:42Z")

</div>

I think I found it! If I just add a line in the script, to list all the executables in C:\Windows\System32 … when run from my local shell, it’s fine - wsl.exe is there. But when the same script is called from Plex, it’s missing! Seems this may be a 32 vs. 64 bit issue. I admit, not sure how to get Plex to call the batch file in 64 bit mode.

Thanks!

---

<div class="post-metadata">

**Author:** ![nwsurfer](https://avatars.discourse-cdn.com/v4/letter/n/e9c0ed/32.png) [@nwsurfer](https://forums.plex.tv/u/nwsurfer)\
**Post date:** [January 29, 2022, 5:14pm UTC](https://forums.plex.tv/t/solved-postprocessing-script-cant-call-wsl-exe-from-batch-file/773492/6 "2022-01-29T17:14:09Z")

</div>

Nice. I’m glad you figure it out.

I’m running a Ubuntu server. When I created a post processing script, I ran into the same issue as you. I had to give the user “plex” the ability to run the cmd in the plex postprocessing folder. Therefore, I thought that is what the issue might have been.

---

<div class="post-metadata">

**Author:** ![rmorris](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/rmorris/32/13669_2.png) [@rmorris](https://forums.plex.tv/u/rmorris)\
**Post date:** [January 29, 2022, 5:59pm UTC](https://forums.plex.tv/t/solved-postprocessing-script-cant-call-wsl-exe-from-batch-file/773492/7 "2022-01-29T17:59:51Z")

</div>

Appreciate it - thanks!

Ya, figured it out (I think) - but no solution I can find though ☹. Not sure why Plex is executing the script this way.

---

<div class="post-metadata">

**Author:** ![rmorris](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/rmorris/32/13669_2.png) [@rmorris](https://forums.plex.tv/u/rmorris)\
**Post date:** [January 29, 2022, 8:31pm UTC](https://forums.plex.tv/t/solved-postprocessing-script-cant-call-wsl-exe-from-batch-file/773492/8 "2022-01-29T20:31:02Z")

</div>

OK, got it! It’s screwy, but figured it out - posting here, so hopefully others don’t have to go through the same pain.

The issue is that Plex launches a 32 bit “shell” (Console Host or Terminal) =\> you can’t directly see 64 bit applications, like wsl. Or at least … not in the usual place (C:\Windows\System32). Rather, in 32 bit mode, you have to access 64 bit applications at C:\Windows\Sysnative! System32 is mapped (for 32 bit applications) to C:\Windows\SysWOW64. Confused yet!!!

Bottom line =\> in your Windows scripts, make sure to access 64 bit applications through C:\Windows\Sysnative.

Marking this as solved - so hopefully this gets captured in the Plex docs (again, only to spare others the same learning / pain).

Thanks!

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/plex/original/3X/2/a/2acb9765406f63293d357b4ec509ec39aa28f2ad.png) [@system](https://forums.plex.tv/u/system)\
**Post date:** [April 29, 2022, 8:31pm UTC](https://forums.plex.tv/t/solved-postprocessing-script-cant-call-wsl-exe-from-batch-file/773492/9 "2022-04-29T20:31:52Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
