全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:1612
推到 Plurk!
推到 Facebook!

請問如何將這一批次檔改寫成Delphi程式

尚未結案
fanny
一般會員


發表:10
回覆:26
積分:7
註冊:2002-07-19

發送簡訊給我
#1 引用回覆 回覆 發表時間:2003-05-06 10:19:33 IP:61.222.xxx.xxx 未訂閱
各位前輩,想請問我如何將以下這之批次檔改寫成Delphi程式 @echo off %windir%\SYSTEM\eSLogonc.exe close %windir%\SYSTEM\esoehk.exe -u CertSync.exe close RmvReg.exe RmvReg.ini exit Thanks~~
cmj
高階會員


發表:15
回覆:242
積分:226
註冊:2002-06-12

發送簡訊給我
#2 引用回覆 回覆 發表時間:2003-05-06 11:37:31 IP:211.76.xxx.xxx 未訂閱
參考下列函數
1.The GetSystemDirectory function retrieves the path of the Windows  
  system directory
  UINT GetSystemDirectory(
       LPTSTR lpBuffer,        // address of buffer for system directory 
       UINT uSize );        // size of directory buffer 
   
2.The WinExec function runs the specified application. 
  UINT WinExec(
       LPCSTR lpCmdLine,        // address of command line 
       UINT uCmdShow);         // window style for new application     3.The CreateProcess function creates a new process and its primary thread. The new process executes the specified executable file.       BOOL CreateProcess(
     LPCTSTR lpApplicationName,        // pointer to name of executable module 
     LPTSTR lpCommandLine,        // pointer to command line string
     LPSECURITY_ATTRIBUTES lpProcessAttributes,        // pointer to process security attributes 
     LPSECURITY_ATTRIBUTES lpThreadAttributes,        // pointer to thread security attributes 
     BOOL bInheritHandles,        // handle inheritance flag 
     DWORD dwCreationFlags,        // creation flags 
     LPVOID lpEnvironment,        // pointer to new environment block 
     LPCTSTR lpCurrentDirectory,        // pointer to current directory name 
     LPSTARTUPINFO lpStartupInfo,        // pointer to STARTUPINFO 
     LPPROCESS_INFORMATION lpProcessInformation         // pointer to PROCESS_INFORMATION  
   );        
1取windows之system目錄 2,3執行一支exe檔
更詳細資料可以參考windows api Help說明,也可以下載本站
Window API 函式說明檔(繁體,chm格式) , Cooky Kid 
 
wnhoo
高階會員


發表:75
回覆:443
積分:198
註冊:2003-04-22

發送簡訊給我
#3 引用回覆 回覆 發表時間:2003-05-06 12:55:11 IP:61.155.xxx.xxx 未訂閱
1.写批处理文件 var f:textfile; begin assignfile(f,'c:\delme.bat'); rewrite(f); writeln(f,'@echo off'); writeln(f,'%windir%\SYSTEM\eSLogonc.exe close'); writeln(f,'%windir%\SYSTEM\esoehk.exe -u'); writeln(f,'CertSync.exe close'); writeln(f,'RmvReg.exe RmvReg.ini'); writeln(f,'del c:\delme.bat'); closefile(f); winexec(pchar('c:\delme.bat'),SW_HIDE); end;    2.直接执行 var a,b,c,d,e,f:pchar; begin a:=pchar('COMMAND.COM /C @echo off ' ) ; b:=pchar('COMMAND.COM /C %windir%\SYSTEM\eSLogonc.exe close'); c:=pchar('COMMAND.COM /C %windir%\SYSTEM\esoehk.exe -u ') ; d:=pchar('COMMAND.COM /C CertSync.exe close' ); e:=pchar('COMMAND.COM /C RmvReg.exe RmvReg.ini'); f:=pchar('COMMAND.COM /C exit' ); WinExec(a, sw_hide); WinExec(b, sw_hide); WinExec(c, sw_hide); WinExec(d, sw_hide); WinExec(e, sw_hide); WinExec(f, sw_hide); end;    以上程序我均测试通过!!! 希望能对你有所帮助! 风花雪月 e梦情缘
------
风花雪月 e梦情缘
fanny
一般會員


發表:10
回覆:26
積分:7
註冊:2002-07-19

發送簡訊給我
#4 引用回覆 回覆 發表時間:2003-05-06 15:06:55 IP:61.222.xxx.xxx 未訂閱
引言: 1.写批处理文件 var f:textfile; begin assignfile(f,'c:\delme.bat'); rewrite(f); writeln(f,'@echo off'); writeln(f,'%windir%\SYSTEM\eSLogonc.exe close'); writeln(f,'%windir%\SYSTEM\esoehk.exe -u'); writeln(f,'CertSync.exe close'); writeln(f,'RmvReg.exe RmvReg.ini'); writeln(f,'del c:\delme.bat'); closefile(f); winexec(pchar('c:\delme.bat'),SW_HIDE); end; 2.直接执行 var a,b,c,d,e,f:pchar; begin a:=pchar('COMMAND.COM /C @echo off ' ) ; b:=pchar('COMMAND.COM /C %windir%\SYSTEM\eSLogonc.exe close'); c:=pchar('COMMAND.COM /C %windir%\SYSTEM\esoehk.exe -u ') ; d:=pchar('COMMAND.COM /C CertSync.exe close' ); e:=pchar('COMMAND.COM /C RmvReg.exe RmvReg.ini'); f:=pchar('COMMAND.COM /C exit' ); WinExec(a, sw_hide); WinExec(b, sw_hide); WinExec(c, sw_hide); WinExec(d, sw_hide); WinExec(e, sw_hide); WinExec(f, sw_hide); end; 以上程序我均测试通过!!! 希望能对你有所帮助! 风花雪月 e梦情缘
Thanks~~ 可是我eSLogonc.exe還是沒有close WinExec(pchar('COMMAND.COM /C ' path 'CertSync.exe close'),sw_hide); Why~~
wnhoo
高階會員


發表:75
回覆:443
積分:198
註冊:2003-04-22

發送簡訊給我
#5 引用回覆 回覆 發表時間:2003-05-06 15:25:32 IP:61.155.xxx.xxx 未訂閱
//程序结束 application.Terminate;    如果你用的是批处理语句,请最好创建临时批处理文件。 在完成后删除,并关闭自己application.Terminate;    var f:textfile; begin assignfile(f,'c:\delme.bat'); rewrite(f); writeln(f,'@echo off'); writeln(f,'%windir%\SYSTEM\eSLogonc.exe close'); writeln(f,'%windir%\SYSTEM\esoehk.exe -u'); writeln(f,'CertSync.exe close'); writeln(f,'RmvReg.exe RmvReg.ini'); writeln(f,'del c:\delme.bat'); closefile(f); winexec(pchar('c:\delme.bat'),SW_HIDE); //close me application.Terminate;    end;    command 参数供参考 Starts a new instance of the MS-DOS command interpreter.    COMMAND [[drive:]path] [device] [/E:nnnnn] [/P] [/C string] [/MSG]    [drive:]path    Specifies the directory containing COMMAND.COM file.    device       Specifies the device to use for command input and output.    /E:nnnnn     Sets the initial environment size to nnnnn bytes.    /P           Makes the new command interpreter permanent (can't exit).    /C string    Carries out the command specified by string, and then stops.    /MSG         Specifies that all error messages be stored in memory. You need to specify /P with this switch.    风花雪月 e梦情缘
發表人 - wnhoo 於 2003/05/06 15:28:59
------
风花雪月 e梦情缘
wnhoo
高階會員


發表:75
回覆:443
積分:198
註冊:2003-04-22

發送簡訊給我
#6 引用回覆 回覆 發表時間:2003-05-06 15:39:34 IP:61.155.xxx.xxx 未訂閱
修改如下:(去掉 CLOSE参数) var a,b,c,d,e,f:pchar; begin a:=pchar('COMMAND.COM /C @echo off ' ) ; b:=pchar('COMMAND.COM /C %windir%\SYSTEM\eSLogonc.exe'); c:=pchar('COMMAND.COM /C %windir%\SYSTEM\esoehk.exe -u ') ; d:=pchar('COMMAND.COM /C CertSync.exe' ); e:=pchar('COMMAND.COM /C RmvReg.exe RmvReg.ini'); f:=pchar('COMMAND.COM /C exit' ); WinExec(a, sw_hide); WinExec(b, sw_hide); WinExec(c, sw_hide); WinExec(d, sw_hide); WinExec(e, sw_hide); WinExec(f, sw_hide); //close me //application.Terminate; end;    你可以试验一下    风花雪月 e梦情缘
------
风花雪月 e梦情缘
fanny
一般會員


發表:10
回覆:26
積分:7
註冊:2002-07-19

發送簡訊給我
#7 引用回覆 回覆 發表時間:2003-05-07 09:59:31 IP:61.222.xxx.xxx 未訂閱
Thanks~~ 已經可以了 再請問一下 在winexec有沒有加command, com /c 差在哪裡?
wnhoo
高階會員


發表:75
回覆:443
積分:198
註冊:2003-04-22

發送簡訊給我
#8 引用回覆 回覆 發表時間:2003-05-07 10:44:58 IP:61.155.xxx.xxx 未訂閱
请将清楚些,我不懂您说的意识!    风花雪月 e梦情缘
------
风花雪月 e梦情缘
fanny
一般會員


發表:10
回覆:26
積分:7
註冊:2002-07-19

發送簡訊給我
#9 引用回覆 回覆 發表時間:2003-05-09 13:52:05 IP:61.222.xxx.xxx 未訂閱
引言: winexec(PChar('CertSync.exe close'),SW_SHOW ); WinExec(pchar('COMMAND.COM /C CertSync.exe close'),sw_hide); where is the different between these command?
系統時間:2024-06-26 9:16:32
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!