BACKGROUND:
I'm learning Powershell.
Attempting to create scripts and execute commands involves a certain amount of trial and error for someone of my limited experience, and I therefore find it useful to occasionally wipe the session clean of all variable values and re-execute a set of commands from scratch.
This can be done by closing the Powershell window and re-opening a new one, navigating to my script directory, etc. But I'd prefer an easier way. Googling indicates that the preferred method is to type "powershell" at a PS command prompt. And indeed, this causes a new local session, free of previously set values and modules, to launch.
PROBLEM:
The new Powershell session that loads is of some earlier version from 2016, thus rendering the features that I need unavailable. The following screenshot shows how the new Powershell session comes up in version 5, whereas I would've expected version 7.
(Unfortunately, the site won't allow me to upload the screenshot so I can't include it. It showed $PSVersionTable returning 7.1.0-preview.2, my execution of a "powershell" command, and $PSVersionTable subsequently returning 5.1.14393.3383).
What am I doing wrong? I'd like to either (a) have the "powershell" command load version 7, or (b) learn of some other method to quickly launch a clean local powershell session for interactive use, from an existing one.
I tried "powershell -version 7.1.0-preview.2" and "powershell -version 7" both of which yield "Cannot start Windows PowerShell version 7 because it is not installed." But as you can see from the screenshot, version 7 is indeed installed.