Home > database >  Cannot run .exe file from VS Code Terminal / Powershell
Cannot run .exe file from VS Code Terminal / Powershell

Time:08-08

In my folder are these files:

hello.cpp hello.exe hello.ilk hello.pdb

When I try to execute the .exe file within a terminal in VS Code I receive this:

C:\Users\User\Documents\VS_Code> hello.exe    

hello.exe : The term 'hello.exe' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the 
    path is correct and try again.
    At line:1 char:1
      hello.exe
      ~~~~~~~~~
          CategoryInfo          : ObjectNotFound: (hello.exe:String) [], CommandNotFoundException
          FullyQualifiedErrorId : CommandNotFoundException
    
    Suggestion [3,General]: The command hello.exe was not found, but does exist in the current location. Windows PowerShell does not load commands from the current location by default. If you trust this command, instead type: ".\hello.exe". See "get-help about_Command_Precedence" for more details.

When I'm running it from the developer prompter from Visual Studio it works.

CodePudding user response:

I think your issue can be solved by just looking at the error suggestion. It says to use .\hello.exe .

Hope this helps :)

  • Related