Autor Beitrag
LDMatrix17
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 73

xXpProOxsP2x
Flash5~Flash7 MX 2004 Prof.~Flash 8 Prof.~Delphi 7 prof.&HTML
BeitragVerfasst: Fr 24.03.06 16:08 
Hallo leute! bin mal wieder ;)

warum kann ich keine umlaute wie ä,ü,ö in Batch(*.Bat) Dateien benutzen??

ich habe versucht mit
@Echo off
Chcp 1252
Xcopy C:\lolmenü\*.* d:\
....
....
Chcp 850

trotzdem!! geht nicht!!
:roll:

_________________
~sOm3!~gUrLs!~sOm3!~dAyS!~L!f3~iS!~nOT!~bOriNg!!~
azubi_20
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 593

WinXP SP2, Ubuntu 8.4
D7 Enterp., D2005 Prof., Java (Eclipse 3.4.0)
BeitragVerfasst: Fr 24.03.06 16:24 
Windows und DOS haben einen unterschiedlichen Tabellensatz
Schreib deinen Batch mit "edit" (Ausführen->edit). Dann wird er im DOS-Zeichenstz geschrieben.
LDMatrix17 Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 73

xXpProOxsP2x
Flash5~Flash7 MX 2004 Prof.~Flash 8 Prof.~Delphi 7 prof.&HTML
BeitragVerfasst: Fr 24.03.06 16:42 
ne! da habe ich schon wieder nen problem!

weil ich die datei aus Delphi gespeichert habe!
soO memo.lines.SavetoFile('asdasd.bat') :oops:

_________________
~sOm3!~gUrLs!~sOm3!~dAyS!~L!f3~iS!~nOT!~bOriNg!!~
azubi_20
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 593

WinXP SP2, Ubuntu 8.4
D7 Enterp., D2005 Prof., Java (Eclipse 3.4.0)
BeitragVerfasst: Fr 24.03.06 16:54 
Dann musst du die Datei vorher mit vom ANSI- in den ASCII-Zeichensatz umwandeln.
z.B. so :
ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure AnsiToAscii(var S: string);
begin
  CharToOemBuff(Pointer(S), Pointer(S), Length(S));
end;

Es gibt aber auch noch andere Methoden, einfach mal Suche bei Google GOOGLEN :)
LDMatrix17 Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 73

xXpProOxsP2x
Flash5~Flash7 MX 2004 Prof.~Flash 8 Prof.~Delphi 7 prof.&HTML
BeitragVerfasst: Fr 24.03.06 17:17 
Kannst du mir bitte ein kleines Beispiel geben?

MFG
Christian

_________________
~sOm3!~gUrLs!~sOm3!~dAyS!~L!f3~iS!~nOT!~bOriNg!!~
azubi_20
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 593

WinXP SP2, Ubuntu 8.4
D7 Enterp., D2005 Prof., Java (Eclipse 3.4.0)
BeitragVerfasst: Fr 24.03.06 17:25 
alle zeilen durchgehen (memo.lines.count)
von memo.lines kannst du dir die Zeile als String holen
String umwandeln in ASCII (z.B. mit oben genannter funktion)
speichern
LDMatrix17 Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 73

xXpProOxsP2x
Flash5~Flash7 MX 2004 Prof.~Flash 8 Prof.~Delphi 7 prof.&HTML
BeitragVerfasst: Fr 24.03.06 17:42 
:roll: kommt immer fehlermeldung!!

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
  S := 'Xcopy g:\meine Daten\Kontoauszüge\*.* d:\';
  For I := 1 to length(s) do
   begin
    CharToOemBuff(Pointer(s),Pointer(s),Length(S[i]));
   end;
   memo1.Lines.Add(S);
   memo1.Lines.SaveToFile('C:\test.bat');


Bitte lach mich nicht aus ;)
ich habe das mit ansi nach ascii wirklich nicht kapiert! :cry:

Christian

Moderiert von user profile iconUGrohne: Beitragsformatierung überarbeitet.

_________________
~sOm3!~gUrLs!~sOm3!~dAyS!~L!f3~iS!~nOT!~bOriNg!!~
0xCC
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 150



BeitragVerfasst: Fr 24.03.06 18:06 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
procedure TForm1.Button1Click(Sender: TObject);

  function AnsiToAscii(s: string):string;
  begin
    setlength(result, length(s));
    CharToOemBuff(@s[1], @result[1], length(s));
  end;

  const sourcepath = 'e:\löl';
        targetpath = 'e:\lül';
        batchfile = 'e:\etest.bat';

var s: string;
   temp: Tstringlist;
   src, target : string;
begin
  src := AnsiToAscii(sourcepath);
  target :=AnsiToAscii(targetpath);
  s := 'echo *** batch-test ***'#13#10'Xcopy "' +
      includetrailingbackslash(src) +'*.*" "' +
      includetrailingbackslash(target) + '"';
  temp := tstringlist.create;
  temp.Text := s;
  temp.SaveToFile(batchfile);
  temp.Free;
end;


die funktion von meinem vorgänger führte übrigens aus verständlichen gründen zu einer zugriffsverletzung.
LDMatrix17 Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 73

xXpProOxsP2x
Flash5~Flash7 MX 2004 Prof.~Flash 8 Prof.~Delphi 7 prof.&HTML
BeitragVerfasst: Fr 24.03.06 18:44 
it's working!!!!
danke sehr!

Christian

_________________
~sOm3!~gUrLs!~sOm3!~dAyS!~L!f3~iS!~nOT!~bOriNg!!~