Autor Beitrag
Experience1986
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 192

Win XP Pro SP2
Delphi 7
BeitragVerfasst: So 01.02.04 12:20 
hi,

Ich bin gerade daran ein Programm zu schreiben, weclhes die Windows Autostarts managen kann.

Nun stehe ich vor dem Problem das bei manchen einträge Start Parameter an die Exe gehängt wurde

c:\test.exe /min /bla /usw

Wie kann ich diese nun aus dem Pfad (String) entnehmen?
Ich brauch den Pfad ohne Parameter, da ich aus der Exe das Icon und Versionsinformationen auslesen will.
tomtom62
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 278

WIN 2000, XP prof
D5 prof.
BeitragVerfasst: So 01.02.04 12:37 
Wie wäre es mit ExtractFileName bzw. ExtractFilePath ?
Experience1986 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 192

Win XP Pro SP2
Delphi 7
BeitragVerfasst: So 01.02.04 12:48 
habe ich gerade versucht, ich habe mir den Pfad und den Dateinamen extrahiert und dann wieder zusammen geführt.

Leide rnimmt ExtractFileName scheinbar die Parameter mit, so das ich wieder am Anfang meínes Problemes stehe, aber dafür muss es doch eine Lösung geben?
KidPaddle
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 351

WinXP,Linux
D7 Prof, XE7
BeitragVerfasst: So 01.02.04 13:51 
Unter Windows kannst nach dem '/' - Zeichen suchen und dann alle Zeichen danach entfernen.

ausblenden Delphi-Quelltext
1:
2:
3:
  if (Pos('/', Pfad) > 0) then begin
    Pfad := Trim(Copy(Pfad, 1, Pos('/', Pfad) - 1));
  end;


Gruß
KidPaddle
Experience1986 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 192

Win XP Pro SP2
Delphi 7
BeitragVerfasst: So 01.02.04 13:53 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
const 
  Endungen : array[0..2] of string[4] = 
    ('.exe','.bat','.com'); 
var 
  s, t : string; 
  a, b : Integer; 
begin 
  s:='c:\program files\test.exe /abc -asd fdd'; 
  t:=ExtractFileName(s); 
  for a:=0 to 2 do 
  begin 
    b:=Pos(Endungen[a]+' ',t); 
    if b > 0 then 
    begin 
      t:=Copy(t,1,b+3); 
      Break; 
    end; 
  end; 
  Label1.Caption:=ExtractFilePath(s)+t;



^^^^ Geht perfekt, lowercase fehlt da oben noch, aber egal
BungeeBug
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 901



BeitragVerfasst: So 01.02.04 14:18 
Hi,

was du suchst heißt

Suche in: Delphi-Forum, Delphi-Library PARAMSTR und Suche in: Delphi-Forum, Delphi-Library PARAMCOUNT

Was oben steht ist glaub ich nicht möglich ...
Experience1986 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 192

Win XP Pro SP2
Delphi 7
BeitragVerfasst: So 01.02.04 15:17 
es ist möglich es geht ja.

PramStr ist doch nuur für die iegene Exe, also für das Programm wo ParamStr ausgeführt wird.