批处理直接用记事本写bat就可以了,用不到delphi……汗
B. 急!如何使用Delphi调用执行DOS批处理文件!
我使用以下方法,但发现执行后,进程中多一个WinoldAPP,退出程序也不消失请各位大虾指教!function
ExecuteFile(const
FileName,
Params,
DefaultDir:
string;
ShowCmd:
Integer):
THandle;var
zFileName,
zParams,
zDir:
array[0..79]
of
Char;begin
Result
:=
ShellExecute(Application.MainForm.Handle,
nil,
StrPCopy(zFileName,
FileName),
StrPCopy(zParams,
Params),
StrPCopy(zDir,
DefaultDir),
ShowCmd);end;ExecuteFile('pBar.bat','0','PBar.bat',0);
C. 用Delphi,如何将一个a.bat批处理改成a.exe文件大侠求助啊主要是用来不让别人看到a.bat里面的代码。
内嵌 cmd.exe /c a.bat
D. 求教Delphi各个版本的批处理写法!
delphi的命令行编译工具是dcc32.exe,可以执行dcc32
/?看看帮助。
E. delphi 执行 批处理文件怎样能不出现那个黑框
可以,你把bat文件转换成exe文件执行,转的时候勾选不显示运行框哪一项
F. delphi如何获取批处理当前执行状况
举例来说吧,比如想把ipconfig执行结果写到一个stringlist里。
var
mylist:TStringList;
begin
WinExec('cmd.exe /c ipconfig>c:\myfile.txt',SW_HIDE);
Sleep(1000); //必须要的,看命令需要的时间
mylist:=TStringList.Create;
mylist.loadfromfile('c:\myfile.txt');
ShowMessage(mylist.Text);
end;
G. 批处理翻译成delphi,应该怎么写呢
上面的批处理写成一个delphi函数。解决方案 »保存为a.bat在delphi中调用WinExec('你的路径\a.bat', SW_HIDE);如果和可执行文件在同一.
H. 如何在Delphi里执行批处理文件
打开记事本 写入多行命令 然后保存为.bat 文件即可 比如这是一个很简单的批处理的原文 c:\abc\*.* d:\abc del c:\abc\*.* ren d:\abc\*.jpg *.gif 运行这个批处理文件时 就会将上面三个命令同时执行
I. Delphi调用bat时,如何在bat执行完成后结束这个Delphi程序
那就用下面这个函数来执行你的bat吧。
functionWinExecAndWait32(FileName:String;Visibility:integer):DWORD;
var
zAppName:array[0..512]ofchar;
zCurDir:array[0..255]ofchar;
WorkDir:String;
StartupInfo:TStartupInfo;
ProcessInfo:TProcessInformation;
begin
StrPCopy(zAppName,FileName);
GetDir(0,WorkDir);
StrPCopy(zCurDir,WorkDir);
FillChar(StartupInfo,Sizeof(StartupInfo),#0);
StartupInfo.cb:=Sizeof(StartupInfo);
StartupInfo.dwFlags:=STARTF_USESHOWWINDOW;
StartupInfo.wShowWindow:=Visibility;
ifnotCreateProcess(
nil,
zAppName,{pointertocommandlinestring}
nil,{}
nil,{}
false,{handleinheritanceflag}
CREATE_NEW_CONSOLEor{creationflags}
NORMAL_PRIORITY_CLASS,
nil,{pointertonewenvironmentblock}
nil,{pointertocurrentdirectoryname}
StartupInfo,{pointertoSTARTUPINFO}
ProcessInfo{pointertoPROCESS_INF}
)
thenResult:=$FFFFFFFFelsebegin
WaitforSingleObject(ProcessInfo.hProcess,INFINITE);
GetExitCodeProcess(ProcessInfo.hProcess,Result);
end;
end;
J. 怎样用delphi进行有条件的批处理
先createprocess一个进程,然后用waitforsingleobject函数等待执行完后继续执行你自己的代码