delphi执行cmd命令和bat文件
转载地址:http://blog.****.net/hutao1101175783/article/details/42807063
cmd:='echo d | Xcopy '+BasePath+' '+TargetPath+' /s/e';
i:=ShellExecute(Handle,nil,'cmd.exe',PChar('/K '+cmd),nil,SW_HIDE);
ShellExecute(Handle,nil, 'cmd.exe',pchar('/C '+GetCurrentDir+'uild.bat'), nil, SW_HIDE);
执行命令前面加“/K”,执行bat文件前面加"/C"
还有就是 如果有的CMD命令执行后需要询问再输入参数才能继续执行,echo 参数 |