Executing PoSh line by line in VS Code

,

Another post for me that is simple and hopefully serves as an example for people trying to get blogging as #SQLNewBloggers.

I’ve had to relearn this trick multiple times, so I decided to write a post. The simple answer is highlight code and press F8.

I’ve come to enjoy writing PoSh in VS Code, but I often end up writing a bunch of the code in a command window, trying out specific things. Often this is because I’m working in a specific folder. Sometimes I’ll get caught up in typing in the VS Code terminal, forgetting to edit the actual script.

Lots of sites have posts on this, but the simple thing is to pick a line and then click F8. The code will run in your terminal window, and you can see the results. Here’s an example for me.

2020-04-21 12_51_44-? $filter = _e__Documents_GitHub_MultiTena • Untitled-2 - Visual Studio Code

You can actually just put the cursor on a line and click F8. I’ve got a short gif that shows this.

poshvscode

The next time you want to work through a PoSh problem line by line, consider using VS Code and F8.

SQLNewBlogger

This is one of those things I’ve googled too many times. So I took 4-5 minutes to just type this up, grab a couple screenshots, and put this together.

It’s focused tightly on one thing, executing PoSh. I don’t need to explain more to show this piece of knowledge, and hopefully remember it in the future.

Original post (opens in new tab)
View comments in original post (opens in new tab)

Rate

5 (2)

Share

Share

Rate

5 (2)