我的部分代码:
  Prog := 'p.exe'
  FileName := 'a.txt'
  CommandLine := Prog + ' ' + FileName;
  Dir := 'c:\temp';
  .......
  B := CreateProcess(Nil, PChar(CommandLine),  nil,  nil, True, CREATE_NEW_CONSOLE, nil, PChar(Dir),   StartInfo,   ProceInfo );  Showmessage(CommandLine);
  ShowMessage(GetCommandLine);
  .......第一个显示 'p.exe a.txt'
第二个显示 'c:\temp\Project1.exe'为什么阿,CommandLine要什么内容阿,不是DOS下输入的命令行么?
在线等

解决方案 »

  1.   

    CommandLine 是 Prog + ' ' + FileName; 的值而 GetCommandLine 是系统自带的函数,得到的是你当前程序的全路径,不同的概念
      

  2.   


    如果Dos下输入p.exe a.txt 可以执行,为什么用Delphi 调用会死机阿?
      

  3.   

    CommandLine  的内容没有错 把
      

  4.   

    另外prog := 'p.exe';
     commandline :='a.txt'
     createProcess(pchar(prog), Pchar(commandLine)......

      Commandline :='p.exe a.txt';
      CreateProcess (nil, Pchar(CommandLine)...
    有什么区别阿?
    请高人指点
      

  5.   

    http://www.somade.com/是个很专业的技术社区,去那里找找吧,或许有你要的答案~
      

  6.   

    网上搜索一下,
    大把的关于CreateProcess的内容。