PowerShell Tips: Call Operator

I've really enjoyed working in PowerShell, but having never really worked with the Command Line or shell scripting before, there's a lot of little tips and tricks out there that I wish had been compiled into a quick start guide.

One of those examples is how a command would work in the Command Prompt but not in the PowerShell (PS) window. Isn't PS supposed to be an upgrade?

Turns out there's an operator you need to add, the Call Operator: &.

I figured this out as I was working with Mongo DB and trying to figure out how I can start the instance from the Cmd Prompt but not the PS Terminal.

Cmd: "C:\Program Files\MongoDB\Server\3.6\bin\mongod.exe" --dbpath E:\MongoDatabase\Data
PS: & "C:\Program Files\MongoDB\Server\3.6\bin\mongod.exe" --dbpath E:\MongoDatabase\Data

Author image
Hi, I'm Aaron Grossman, a Business Intelligence developer documenting what I've learned as I continue to grow my career. I can be reached at me@aaronjgrossman.com.