Last time we looked at running VBScript files in 64 bit from within PrimalScript 2009. As you may recall, the only thing required was to provide a path to the 64 bit CScript.exe or WScript.exe and substituting “sysnative” for “system32”. The rest was all automatic.
As I mentioned last time, PowerShell requires some extra work. PrimalScript redirects stdin, stdout and stderr when capturing the output of a process and PowerShell.exe does not react well to that. This has been a PowerShell problem since V1 and wasn’t fixed with V2. Basically the PowerShell process will just hang and do nothing when you redirect stdin. I am assuming that if PowerShell sees a redirected stdin stream it just awaits commands from there and ignores anything else.
I have created a little helper app that will take care of that:
Download and extract the executable to your PrimalScript 2009 installation folder.
Right click anywhere in the tools browser and select “Customize…” and add a new tool in a group of your choice.
Name the new tool “PowerShell (64 bit) or whatever your like and set the properties as follows:
Command line: Exec64
Arguments: C:\Windows\System32\WindowsPowerShell\V1.0\powershell.exe -NonInteractive \”&’$File$’\”
Initial Directory: $FileDir$
Check “Capture Output”
In order to run the current script in 64 bit mode you only have to click on the icon.