C语言 如何使用命令提示符运行 ac 程序
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16367190/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to run a c program using command prompt
提问by Shubham Saxena
How to run a c program using command prompt on win 7 with codeblocks installed and if location of c file is different than default location?
如何在安装了代码块的 win 7 上使用命令提示符运行 ac 程序,如果 c 文件的位置与默认位置不同?
回答by Some programmer dude
- Compile and link the project
- Open a command window
- Change directory to where the executable is created
- Run the executable
- 编译并链接项目
- 打开命令窗口
- 将目录更改为创建可执行文件的位置
- 运行可执行文件
回答by Some programmer dude
I'm not a windows guru, but that should be pretty easy. Just so that we are on the same page here: your "c file" is just a text file. Your codeblocks is just a fancy text-editor for that text file. When you click "compile" your codeblocks invokes a compiler - a program which translates the c instructions in the textfile, into binary. Now, run the following command to go to the main directory.
我不是 Windows 专家,但这应该很容易。只是为了让我们在同一页面上:您的“c 文件”只是一个文本文件。您的代码块只是该文本文件的精美文本编辑器。当您单击“编译”时,您的代码块会调用编译器 - 一个将文本文件中的 c 指令转换为二进制的程序。现在,运行以下命令转到主目录。
cd C:\
Than run
比跑
dir /s /b myfile.c
if you are looking for your uncompiled c file. If you are looking for the binary:
如果您正在寻找未编译的 c 文件。如果您正在寻找二进制文件:
dir /s /b myfile.exe
To run your program :
运行你的程序:
C:\path_to_program\program.exe

