简体   繁体   中英

Cannot run .exe file from VS Code Terminal / Powershell

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.

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

Hope this helps:)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM