How to run Powershell x86 within Visual Studio Code x64?

Viewed 3358

I've got a situation where I am using the 64-bit version of Visual Studio Code to write/debug a powershell script. However, because of what the Powershell script is doing it needs to run within the 32-bit version of Powershell. It's using some libs to access an MS Access file, so I have yet to find a way to make things work within Powershell x64.

Is there a way to tell VS Code to run the 32-bit version of Powershell if VS Code itself is running as 64-bit? For example, can I modify the launch.json file to specify the path of powershell itself?

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "type": "PowerShell",
            "request": "launch",
            "name": "PowerShell Launch Current File",
            "script": "${file}",
            "args": [],
            "cwd": "${file}"
        },
        ...
     ]
}
2 Answers

I found another method that's easier and seems to be provided by VSCode (although it might be an extension I added). In the main window there's a clickable element in the right side of the toolbar:

enter image description here

When you click that a menu appears near the top of the window with some powershell related options, including the ability to switch between x86 and x64:

enter image description here

Related