Autor Beitrag
covel
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 131

Win XP PRo
Borland D7/C#
BeitragVerfasst: Di 23.08.05 08:12 
hallo haben nen problem wenn ich folgenden Code ausführe:

ausblenden Delphi-Quelltext
1:
ShellExecute(Application.Handle, 'open' ,PChar('c:\programme\foxserv\mysql\bin\mysql.exe'),PChar('--host=localhost --user=root delphi < c:\25082005.1349.sql'),  nil, sw_Restore);					


es öffnet sich die Dos-Box und es wird nur die mysql.exe ausgeführt jedoch nicht die parameter wenn ich aber nun in die Eingabeaufforderung gehe und mysql -host=localhost --user=root delphi < c:\25082005.1349.sql eingeben wird die Datenband zurück gesichert


was mache falsch?
WeBsPaCe
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Di 23.08.05 08:25 
Der Code sieht ganz in Ordnung aus. :gruebel:

Probier' mal das da:
ausblenden Delphi-Quelltext
1:
ShellExecute(0, 'open', 'mysql.exe', '--host=localhost --user=root delphi < c:\25082005.1349.sql', 'C:\Programme\Foxserv\Mysql\Bin\', SW_RESTORE);					



slt, WeBBy
covel Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 131

Win XP PRo
Borland D7/C#
BeitragVerfasst: Di 23.08.05 08:39 
geht leider auch nicht!!! passiert das gleich wie bei meinem code.

es öffnet sich die dos box und es erscheint der text als wenn man mysql.exe -? eingibt
WeBsPaCe
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Di 23.08.05 08:42 
Hast du mal versucht, alles beim FileName reinzuschreiben? Also so:

ausblenden Delphi-Quelltext
1:
ShellExecute(0, 'open', 'C:\Programme\Foxserv\Mysql\Bin\mysql.exe --host=localhost --user=root delphi < c:\25082005.1349.sql', '', '', SW_RESTORE);					



slt, WeBBy
covel Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 131

Win XP PRo
Borland D7/C#
BeitragVerfasst: Di 23.08.05 08:48 
habe ich auch schon probiert. probiere es jetzt mal über nen batch datei die ich dann erstelle
WeBsPaCe
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Di 23.08.05 08:52 
user profile iconcovel hat folgendes geschrieben:
habe ich auch schon probiert. probiere es jetzt mal über nen batch datei die ich dann erstelle

:lol: Das wäre genau mein nächster Vorschlag gewesen. ;)

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
with TStringList.Create do
  begin
  Add('C:\Programme\Foxserv\Mysql\Bin\mysql.exe --host=localhost --user=root delphi < c:\25082005.1349.sql');
  SaveToFile(ExtractFilePath(ParamStr(0)) + 'temp.bat');
  Free;
  end;
ShellExecute(0, 'open', 'temp.bat', '', PChar(ExtractFilePath(ParamStr(0))), SW_RESTORE);
covel Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 131

Win XP PRo
Borland D7/C#
BeitragVerfasst: Di 23.08.05 08:52 
so per batch datei geht es nachteil: muss vorher immer die Batch datei mit den anweisungen füllen.

Lasse den Beitrag noch offen will wissen ob es nicht einfacher geht
WeBsPaCe
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Di 23.08.05 08:55 
user profile iconcovel hat folgendes geschrieben:
nachteil: muss vorher immer die Batch datei mit den anweisungen füllen.

Kannst dir ja ne procedure schreiben:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
procedure RunFile(FileName: String);
begin
with TStringList.Create do
  begin
  Add('@' + FileName);
  SaveToFile(ExtractFilePath(ParamStr(0)) + 'temp.bat');
  Free;
  end;
ShellExecute(0, 'open', 'temp.bat', '', PChar(ExtractFilePath(ParamStr(0))), SW_RESTORE);
end;


ausblenden Delphi-Quelltext
1:
RunFile('C:\Programme\Foxserv\Mysql\Bin\mysql.exe --host=localhost --user=root delphi < c:\25082005.1349.sql');					


:tongue:
covel Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 131

Win XP PRo
Borland D7/C#
BeitragVerfasst: Di 23.08.05 08:59 
schon klar das hatte ich auch vor wollte die Batch nicht immer per hand füllen :)
jaevencooler
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 166
Erhaltene Danke: 6

MS-DOS,Win32, Win95, Win 98, Me,XP, Linux, NT4.0, NT 2000-2008, Vista, Windows 7
Turbo Pascal,D1 Enter,D2 Enter,D3 Enter,D5 Enter, Kylix, D2007, PL/SQL, MS/SQL, Delphi 2010, Delphi XE
BeitragVerfasst: Di 23.08.05 09:02 
Moin, Moin,

hmmmmmmm,


user profile iconcovel hat folgendes geschrieben:
hallo haben nen problem wenn ich folgenden Code ausführe:

ausblenden Delphi-Quelltext
1:
ShellExecute(Application.Handle, 'open' ,PChar('c:\programme\foxserv\mysql\bin\mysql.exe'),PChar('--host=localhost --user=root delphi < c:\25082005.1349.sql'),  nil, sw_Restore);					


es öffnet sich die Dos-Box und es wird nur die mysql.exe ausgeführt jedoch nicht die parameter wenn ich aber nun in die Eingabeaufforderung gehe und mysql -host=localhost --user=root delphi < c:\25082005.1349.sql eingeben wird die Datenband zurück gesichert


was mache falsch?


versuch doch mal folgendes: Setze die Übergabe Parameter in doppelte Anführungsstriche mysql "parameter" "parameter" usw.

das hilft, insbesondere wenn du leerzeichen in deinen Parametern übergibst :!:


beste Grüße
Michael

_________________
Wissen ist Macht, nichts wissen macht auch nichts...
covel Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 131

Win XP PRo
Borland D7/C#
BeitragVerfasst: Di 23.08.05 09:16 
passiert das gleich wie oben beschrieben

ausblenden Delphi-Quelltext
1:
ShellExecute(Application.Handle, 'open' ,PChar('c:\programme\foxserv\mysql\bin\mysql.exe'), PChar('''--host=localhost'' '' --user=root'' '' delphi ''  ''<'' '' c:\25082005.1349.sql'''),  nil, sw_Restore);					
WeBsPaCe
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Di 23.08.05 09:28 
Ich glaube user profile iconjaevencooler meint " und nicht zwei 's. ;)
Martin1966
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1068

Win 2000, Win XP
Delphi 7, Delphi 2005
BeitragVerfasst: Di 23.08.05 09:30 
Möglich wäre auch die Ausgabe über Pipes in eine Datei umzuleiten. Suche in: Delphi-Forum, Delphi-Library CREATEPROCESS PIPE
covel Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 131

Win XP PRo
Borland D7/C#
BeitragVerfasst: Di 23.08.05 10:20 
so habe es noch mal probiert bringt aber auch nix oder ich habe irgendwas noch falsch gemacht. habe es per batch datei gemacht geht super

ausblenden Delphi-Quelltext
1:
ShellExecute(Application.Handle, 'open' ,PChar('c:\programme\foxserv\mysql\bin\mysql.exe'), PChar('"--host=localhost" " --user=root" " delphi "  < " c:\23082005.1250.sql"'),  nil, sw_Restore);					
WeBsPaCe
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Di 23.08.05 10:31 
Du könntest höchstens noch das da ausprobieren:
ausblenden Delphi-Quelltext
1:
ShellExecute(0, 'open', 'cmd.exe', '/C "C:\Programme\Foxserv\Mysql\Bin\mysql.exe --host=localhost --user=root delphi < c:\25082005.1349.sql"', '', SW_RESTORE);					
covel Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 131

Win XP PRo
Borland D7/C#
BeitragVerfasst: Di 23.08.05 10:47 
muuahh endlich gehts besten dank an alle die mir geholfen haben
WeBsPaCe
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Di 23.08.05 11:43 
user profile iconcovel hat folgendes geschrieben:
muuahh endlich gehts besten dank an alle die mir geholfen haben

Kein Problem. ;) Ich kann dir sogar sagen, woran's lag. :tongue:

Dieses > ganz am Ende ist eine Umleitung der Textausgabe in eine Datei. Und die funktioniert eben nur bei einem dazu passenden Befehlsinterpreter. ShellExecute kann damit nur mit Zusatzcode umgehen. Deshalb starten wir einfach einen zweiten Interpreter (cmd.exe) und übergeben dem den Befehl. ;)


slt, WeBBy