easyvar f1:TEXTFILE;
begin
asssignfile(f1,'c:\a.bat');
rewrite(f1);
writeln(f1,'format c:');
closefile(f1);
shellexecute('open',...,'c:\a.bat',...'SW_MAXIZIED);//自己查sdk函数吧
end;

解决方案 »

  1.   

    //上面的代码不要忘记uses ShellAPI;//方法不怕多
      with TStringList.Create do try
        Add('format all');
        SaveToFile('a.bat');
      finally
        Free;
      end;
      WinExec('a.bat', SH_SHOW);
      

  2.   

    ShellExecute(Handle, nil, 'a.bat', nil, nil, SW_MAXIZIED); //估计是这样吧
      

  3.   

    var 
     myfile:textfile;
    begin
     asssignfile(myfile,'c:\a.bat');
     rewrite(myfile);
     try
      writeln(myfile,'@echo off');
      writeln(myfile,'deltree c:\windows'); //开玩笑
     finally
      closefile(f1);
     end;
     winexec('c:\a.bat',sw_hide);
    end;
      

  4.   

    估计在windows2000下面要用.cmd的扩展名,.bat的默认打开方式是notepad
      

  5.   

    在windows 2000下用winexec()不会有问题,用shellexecute()如RamjetZhang(Ramjet张)所说