How to run Selected Text using activate.bat instead of ps1 in Visual Studio Code?

Viewed 262

Running into this weird issue and I don't seem to be able to find a solution online or forums. My VS Code was working fine last night, but this morning when I launched VS Code and trying to execute code (in Python) using the Run Selected Text feature, I kept getting "& "C:/Users/jiejenn/Documents/Python Venv/vtest2/Scripts/activate.ps1" & was unexpected at this time." error message.

In the past, VS Code is using the activate.bat file, which is what I want, but all of sudden, PowerShell took over the command. I am trying to revert back to using the activate.bat file instead of activate.ps1.

Can anyone provide me with some guidance how can it be done? Thanks.

I have already Googled for the past 2 hours, haven't find any solution that solves the issue.

1 Answers

It sounds like your default terminal application changed from cmd to PowerShell, possibly during an update. Click the terminal dropdown button and then Select Default Profile to change it back to cmd.

See also this related issue.

Related