How to Run Powershell x86 Inside Visual Studio Code x64?
Windows PowerShell is a popular tool that is used as a command line tool, also called a modern command line tool as it includes the best of the features for popular shells, you may have heard about CMD or command line utility in Windows but the Windows PowerShell is more advance and powerful which is why it is used in Visual Studio Code but it becomes an issue if you want to run the PowerShell x86 in a visual studio code that is based on x64 version.
So in this article, we will understand how we can run the PowerShell x86 inside the Visual Studio code that is in the x64 version.
Powershell x86 vs. Powershell x64
Powershell x86 is your 32-bit version of the original Powershell, there would be very limited cases where you would need 32-bit over 64. Maybe if you were running server 2008 32-bit OS. the PowerShell x86 version can be described as the 32-bit version of the PowerShell, there are rare cases in which you may have to run this version of the PowerShell instead of the usual x64 version such as if you are running the windows server edition of 2008 on 32-bit operating system or some other similar case.
Running the x86 version instead of the PowerShell x64 is a bit tough because there are not many guides available on how we can do that so it is important to understand how we can do this in case any 32-bit server edition-based operating system requires this approach.
How to Run Powershell x86 Inside Visual Studio Code x64?
To run the PowerPoint x86 inside the virtual studio code x64 we will first update the PowerShell to the latest version and then do some configuration inside the visual studio code so that it loads the Powershell x86 as the default version whenever we execute the code, following are the steps we need to take:
Step 1: Open Powershell as Administrator
We need to update the PowerShell to the latest version available, for this go to the start menu and open the PowerShell by clicking on “Run As Administrator”
Step 2: Update Powershell Using Command
To update the PowerShell to the latest version available we use the following command:
winget install --id Microsoft.PowerShell --source winget
Note: Make sure you have active internet connection as this step requires downloading the latest version.
This command will give us the following output:
Step 3: Open the Search Bar in Visual Studio Code
This step requires opening the search bar in the top corner, simply click on the search bar that says “hello” and it will allow you to type your required settings.
Step 4: Open Default Terminal Profile Settings
Type the following command in the search bar and select the option from the menu:
>Terminal: Select Default Profile
(as described in the image below)
Step 5: Select Powershell x86 as Default
After completing the above step click on the option that says PowerShell x86 in its path (in my case it is in the first option but in yours, it can be 2nd or 3rd option)
Step 6: Check if Powershell is Default
We will check whether the setting we just made has been applied or not, for this go to terminal > new terminal or simply type Ctrl + ` [backtick] to open the terminal window, then click on the + icon and make sure that PowerShell is set to default.
Conclusion
Powershell x64 is the most commonly used version in the Powershell software also called just PowerShell because it is the default version of Powershell, unlike the x86 version. whereas the PowerShell x86 is not used commonly and only used in specific OS, any code that is in the x64 or 64-bit is automatically converted to 32-bit.
How to Run Powershell x86 Inside Visual Studio Code x64 – FAQs
What is Powershell x86?
The powershell x86 is simply a version of powershell which stands for 32-bit system, it automatically converts the 64-bit code to the 32-bit version so that it can compile.
When do we need to run Powershell x86?
We only need to run the powershell x86 in specific operating system and special cases such as when we are using the windows 2008 server edition that has 32-bit system configuration.
How is Powershell x86 different from x64?
The powershell x86 is an extension used for the windows powershell 32-bit version so that the compiler can easily convert the 64-bit version to the 32-bit format.