c - 如何从 visual studio 2010 调用批处理文件

标签 c file batch-file execute

我编写了一个代码来生成机翼形状并使用外部程序作为评估工具对其进行评估。我还制作了一个批处理文件,该文件启动该程序执行机翼形状评估所需的一些批处理命令,然后关闭程序....!!

我在每个循环中进行多次评估。我的问题是我找不到通过我的代码运行批处理文件的方法。我使用了下面显示的两种方法,但它们似乎都不能在 visual studio 2010 中工作。我用 C 编写代码,我得到的消息是 C:/Users/Angelos/Documents/CExperiments/BSplines/run.bat 不是内部的命令等等...!

你能检查一下并告诉我我做错了什么吗?

谢谢

void XfoilCall()
{
SHELLEXECUTEINFO ShExecInfo = {0};
ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
ShExecInfo.hwnd = NULL;
ShExecInfo.lpVerb = NULL;
ShExecInfo.lpFile = ("C:/Users/Angelos/Documents/CExperiments/BSplines/run.bat");
ShExecInfo.lpParameters = ("");
ShExecInfo.lpDirectory = NULL;
ShExecInfo.nShow = SW_SHOW;
ShExecInfo.hInstApp = NULL;
ShellExecuteEx(&ShExecInfo);
WaitForSingleObject(ShExecInfo.hProcess,INFINITE);


void XfoilCall()
{
system("C:/Users/Angelos/Documents/CExperiments/BSplines/run.bat");
}

最佳答案

试试这个:

system("cmd C:/Users/Angelos/Documents/CExperiments/BSplines/run.bat");

关于c - 如何从 visual studio 2010 调用批处理文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15351147/

相关文章:

python - 平均-Python

python - python 的 shutil.move() 在 linux 上是原子的吗?

c 赋值,对整数求平均值

javascript - Wasm : Uncaught (in promise) TypeError: Import #0 module ="env" error: module is not an object or function Promise. 然后(异步)(匿名)@(索引):9

c - C 语言中的句子反转?

file - N :1 file descriptors?

windows - 批处理 : Search for string to skip lines above and write results to new file

azure - 使用在批处理文件中运行的 azcopy 复制文件

bash - 从 PuTTY 运行的 shell 脚本返回代码到调用批处理文件?

c - 函数 fmax 的隐式声明