![]() PS C:\> D:\scripts\TestForHostVersion.ps1 Running the script PS C:\> $PSVersionTable So, they can run using the right version by starting or typing in the right version.Ĭode in the sample script #Requires -Version 7.0 This does not mean you could autorun in PSCore, it will throw an error telling the user the defined PS version must be used. ![]() Your other item to ensure that your code will only try and run in PSCore is that you use the #requires statement at the top of all your scripts.Ībout_Requires - PowerShell | Microsoft Docs what you have configured VSCode to use as the default PS version has no impact on what the OS will use. If you want to run the script with PSCore, the type. When you run your script, it will run int the default OS Powershell host, and on Windows that will be default OS version Windows PowerShell, unless you specifically telly it otherwise.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |