0

How do I 'execute' an exe from the PowerShell console?

I know in CMD I can enter the name of the exe and it runs, but that isn't working on PowerShell.

In the directory there's an exe called b2c.exe that I want to run.

Sample commands I Want to Run:

  • b2c get-user
  • b2c help
  • b2c update-user a80a99a7-b018-423f-90fc-d9a30e5dc7ea ......\usertemplate-update-org-id.json

Working example in cmd prompt, and error message from PowerShell:

error details

working example in cmd prompt

2 Answers 2

4

I don't think powershell has the current folder in its search path, try:

.\b2c
Sign up to request clarification or add additional context in comments.

1 Comment

Powershell definitely does not include the current directory in the search path; this is deliberate, as a matter of security.
2

See call operator

& "C:\path\to\b2c.exe" get-user
& "C:\path\to\b2c.exe" help
& "C:\path\to\b2c.exe" update-user a80a99a7-b018-42...

1 Comment

The & operator and the quotes are not necessary here since the path/filename of the executable doesn't contain quotes. (It doesn't hurt, but also isn't necessary.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.