使用C代码打开批处理文件 [英] Open batch file using C code

查看:86
本文介绍了使用C代码打开批处理文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

#include<stdio.h>
#include<conio.h>
#include<dos.h>
#include<stdlib.h>
#include<process.h>

void main()
{
     
     system("f:\\C.BAT"); //open a batch file from F drive
     
     getch();
 }







仅输出空白屏幕



任何人都可以解决为什么文件没有打开的问题。当我运行通过CMD提示时。这是工作。但是通过TC编译器使用c代码无法正常工作。




Output- only blank screen come

Anybody give solution why file is not open. when I run the through CMD prompt. It is working. But through TC compiler using c code not working.

推荐答案

正如其他人已经指出的那样你应该:

  • 检查 system 调用返回值。
  • 检查批处理文件是否实际执行(您可能错过了执行,因为窗口很快就会消失)。
As others already pointed out you should:
  • check system call return value.
  • check if the batch file actually was executed (you may have missed its execution, because the window quickly disappears).


这篇关于使用C代码打开批处理文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆