Autor Beitrag
Harry M.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 754

Win 2000, XP
D2005
BeitragVerfasst: So 13.02.05 06:12 
wie gehts. folgendes geht auf jeden fall nicht:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
Dir:String;
 
SetLength(Dir,254);
GetSystemDirectory(@Dir[1], Length(Dir));
// 1. möglichkeit
WinExec(PChar(Dir+'cmd.exe'),sw_show);
// 2. möglichkeit
ShellExecute(Application.Handle, 'open', PChar(Dir+'cmd.exe'), nil, nil, sw_ShowNormal);


bisher hatte ich immer dieses

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
  BATCHFILE := TStringlist.Create;
  BATCHNAME := 'Temp.bat';
  BATCHFILE.add('@echo off');
  BATCHFILE.add('%COMSPEC%');
  BATCHFILE.add('del %0');

  BATCHFILE.SaveToFile(BATCHNAME);
  WinExec(PChar(BATCHNAME),sw_show);


das funzt zwar, aber es bleibt die temp.bat wenn man nicht mit exit beendet. und das muß nicht sein :wink:

Moderiert von user profile iconGausi: Code- durch Delphi-Tags ersetzt.
Moderiert von user profile iconTino: Topic aus Sonstiges verschoben am Mo 14.02.2005 um 09:19
galagher
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 2562
Erhaltene Danke: 46

Windows 10 Home
Delphi 10.1 Starter, Lazarus 2.0.6
BeitragVerfasst: So 13.02.05 09:32 
Hallo, versuch das mal:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
var
  Dir: String;
  Cmd: array [0..255] of Char;
begin
 SetLength(Dir,254);
 GetSystemDirectory(@Dir[1], Length(Dir));
 StrpCopy(Cmd,Dir);
 StrpCopy(Cmd,Cmd+'\cmd.exe');

 ShellExecute(Application.Handle, 'open', Cmd, nil, nil, sw_ShowNormal);

Ich hab' WinMe, hab's daher mit GetWindowsDirectory statt GetSystemDirectory und command.com statt cmd.exe getestet und es funktionierte!

_________________
gedunstig war's - und fahle wornen zerschellten karsig im gestrock. oh graus, es gloomt der jabberwock - und die graisligen gulpen nurmen!
Harry M. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 754

Win 2000, XP
D2005
BeitragVerfasst: So 13.02.05 12:48 
dat funtz danke und sogar im arbeitsverzeichnis nicht aus %SYSTEMROOT%

gruß