我是编码的完整新手,所以我不了解这个论坛上的大多数类似帖子。
我正在进行一个简单的C编程课程,我需要从PowerShell运行记事本 文件。该文件仅包含以下内容:
#include <stdio.h>
int main()
{
int num = 931;
printf("The number 'num' is %dn", num);
return 0;
}
我叫该文件:variables.c,然后将其放入PowerShell:
PS C:UsersRavenDesktopC Programming> gcc Variables.c -o Variables.exe
接下来是:
PS C:UsersRavenDesktopC Programming> Variables.exe
i然后得到以下错误:
Variables.exe : The term 'Variables.exe' is not recognized as the name of a cmdlet, funct ion, script file, or operable program. Check the spelling of the name, or if a path was i ncluded, verify that the path is correct and try again. At line:1 char:1
+ Variables.exe
+ ~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Variables.exe:String) [], CommandNotFound Exception
+ FullyQualifiedErrorId : CommandNotFoundException
这里发生了什么?
非常感谢!
要在PowerShell中运行EXE,您需要通过使用.
在文件名之前提供通往EXE的完整路径或相对路径,请确保您在正确的目录中并尝试:
.Variables.exe
情况是您正在使用Windows PowerShell。您可以在Windows CMD中执行该filename.exe命令(在EXE文件存储的路径中)。