PowerShell and VS Code does not recognize " Set-Location"

My PowerShell does not recognize the Set-Location, this already occurred at a time every time I run a code in VS Code because my works and projects are in the cloud and in another HD but I never gave importance because it ran normal.

But now I can't open any terminal in the folder itself or do the navigation by switching the HDs

Error:

Set-Location : O termo 'Set-Location' não é reconhecido como nome de cmdlet, função, arquivo de script ou programa
operável. Verifique a grafia do nome ou, se um caminho tiver sido incluído, veja se o caminho está correto e tente
novamente.
No linha:1 caractere:1
+ Set-Location -Path 'G:\OneDrive\Gui\GuiTestes\Python\Projetos ...
+ ~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Set-Location:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

(this is the same error that appears in the VS Code terminal)

.

I checked in PowerShell ISE the commands "installed" and the Set-Location does not really appear (and also another command set-variable, I found out going on the ISE):

insert the description of the image here

Author: Gui Reis, 2020-07-22

1 answers

Good.. I managed to solve it.

Really if you add before any command (native to PowerSheel) the line Import-Module -Name Microsoft.PowerShell.Management and then the command of the PowerShell itself (which is not recognizing) works.

But this only solves manually and eh a bag be doing it..

(I opened the PowerShell in the folder, gave error and then made the commands)

.

Installing the new PowerShell

What I did was install the new PowerShell 7.0 (most updated version of the moment) The version I downloaded was PowerShell-7.0.3-win-x64.msi (89 mb) in this repository.

Version .msi installs direct and Windows itself already configures. Already the version .zip eh as if you had copied the program to your computer, that is, it is not installed in fact with the system but accessible eh. I suggest downloading .msi.

The PowerSheel 7.0 does not subtitle the PowerShell 5, Microsoft itself speaks this, they somehow work together. But he appears directly with the right mouse button and tb with the shift + x, you can even choose whether you want as adm or not:

insert the description of the image here

.

Setting the VS Code terminal:

Since VS Code has the terminal integrated with it, that eh nothing more than PowerShell (you notice by PS written at the beginning of the line), in the settings vc can change the terminal, being able to choose which vc you want (it can be any of your preference, up to some that you downloaded).

In this link shows how to change the terminal. If you have any other problem with the terminal, this link gives you some alternatives.

insert the description of the image here

My suggestion for you eh install this new PowerShell 7.0, it is very worthwhile and eh more 'clean'.

 0
Author: Gui Reis, 2020-07-23 12:27:35