I'm a complete newbie to coding, so I don't understand most of the similar posts on this forum.
I'm doing a simple C programming course, and I need to run a notepad++ file from the Powershell. The file only contains this:
#include <stdio.h>
int main()
{
int num = 931;
printf("The number 'num' is %d\n", num);
return 0;
}
I called the file: Variables.c then I put this into the Powershell:
PS C:\Users\Raven\Desktop\C Programming> gcc Variables.c -o Variables.exe
Followed by:
PS C:\Users\Raven\Desktop\C Programming> Variables.exe
I then get the following error:
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
What is going on here??
Many thanks in advance!
To run an exe in PowerShell you need to either provide the full path to the exe or the relative path by preceding the filename with .\
Ensure you are in the correct directory and try:
.\Variables.exe
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With