Issue
Like in CMD, to run a C++ program, I use the command g++ filename.cpp
, then I run it using the command a.exe
, which opens the output in the CMD itself. How to do such thing using a PowerShell? I am unable to open the file by simple command as a.exe
. Am I doing it the wrong way?
Solution
It is a best practice to use the invocation operator and to quote the command.
& ".\a.exe" p1 p2 p3
PowerShell will also allow the use of /
as the path separator.
& "./a.exe" p1 p2 p3 "p4 with space"
Answered By - lit Answer Checked By - Katrina (WPSolving Volunteer)