특정 명령어가 먹지 않습니다.
ExecuteFile := 'c:\Canon_SW\20160830\Temp_RUN.bat'; // 실행할 프로그램
ParamString := ' '; //'c:\winzip.log'; // 프로그램의 명령행 파라미터
StartInString := ' '; //'c:\'; // 시작 위치
FillChar(SEInfo, SizeOf(SEInfo), 0);
SEInfo.cbSize := SizeOf(TShellExecuteInfo);
with SEInfo do
begin
fMask := SEE_MASK_NOCLOSEPROCESS;
Wnd := Application.Handle;
lpFile := PChar(ExecuteFile);
lpParameters := PChar(ParamString);
lpDirectory := PChar(StartInString);
nShow := SW_SHOWNORMAL;
end;
if ShellExecuteEx(@SEInfo) then
begin
repeat
Application.ProcessMessages;
GetExitCodeProcess(SEInfo.hProcess, ExitCode);
until (ExitCode <> STILL_ACTIVE) or Application.Terminated;
ShowMessage('프로그램이 종료되었습니다');
end
else ShowMessage('프로그램을 실행할 수 없습니다');
===============================================================
아주 간단한 실행구문입니다.
그런데 배치파일에 lpr.exe가 들어있습니다.
lpr -S 192.168.0.8 -P ea3 c:\spool\48435.1608_a3.dat
그런데 그냥 도스창에서는 lpr 명령이 잘 먹습니다.
그런데 프로그램에서 실행시키면 'lpr'은(는) 내부 또는 외부 명령, 실행할 수 있는 프로글앰 , 또는 배치 파일이 아닙니다 라는 메시지가 나타납니다.
환경변수 Path에도 System32 가 잘 들어가 있고 ...
일반 도스창에서 그냥 잘 실행됩니다.
유독 프로그램에서만 안되는군요.
|