tomtombon
Goto Top

Mit AWK Variablen in eine INI schreiben

Ich habe einiges zu meinem Problem gefunden und gelesen.
EIGENTLICH sollte ich keines haben.
Eigentlich..

face-smile

Ich bin dabei ein Programm von einem SW Verteilungssystem in ein anderes zu portieren.
Beim alten SW-Vert. gab es ein spezielle "Sprache", im Prinzip ein angepasstes batch System.
Beim neuen wird alles NUR über normale Windows Batch erledigt, sprich wir erstellen eine install.cmd die man im Prinzip auch manuell (wenn man die Rechte hat) ausführen kann.
Im Prinzip also ganz einfach.
Ich bin in dem Bereich aber blutiger Anfänger, das erleichtert die Lösung der kleinen Probleme am Rande nicht face-wink

Es soll eigentlich "nur" der Name und entsprechend die Mail Adresse in der ini getauscht werden.
Das ermitteln der Daten klappt, habe ich schon mit Echo ausprobiert.
Nur das d**ösige reinschreiben der Daten in die ini will nicht!
face-sad

Rechte sind nicht das Problem, auf der Testkiste bin ich Admin, es wird später alles unter dem useraccount "System" ausgeführt.
Ich habe auch ausprobiert
awk  -v CLASS=User -v VAR=Name -v VALUE="%ldapid%" -f c:\Temp\xtoclass.awk c:\temp\It2001.ini  

Das selbe Ergebnis.

;-((

Hat irgendeiner eine Idee, bzw sieht bei mir einen Schnitzer?

Danke!


::@echo off
pushd %~dp0

:: Check Language
	cscript code.vbs
	call codepage.bat

	
	if not exist "%PROGRAMFILES%\InfoTip\ItEdit32" mkdir "%PROGRAMFILES%\InfoTip\ItEdit32"  
	if not exist "%SystemDrive%\It2001" mkdir "%SystemDrive%\It2001"  
	
	copy /D/V/Y/Z  awk.exe %windir%	
	copy /D/V/Y/Z  shortcut.exe %windir%
	
	copy /D/V/Y/Z  xtoclass.awk c:\Temp
	copy /D/V/Y/Z  It2001.ini c:\Temp
	
	for /f "tokens=1-3" %%a in ('reg query "hklm\software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultUserName') do (set LDAPID=%%c)   
	(set EMAIL=%LDAPID%@...eu)
	
             awk -f c:\Temp\xtoclass.awk -v CLASS=User -v VAR=Name -v VALUE="%ldapid%" c:\temp\It2001.ini  
	awk -f c:\Temp\xtoclass.awk -v CLASS=User -v VAR=EMail -v VALUE="%email%" c:\temp\It2001.ini  
	if "%OSLanguage%" == "1031" awk -f c:\Temp\xtoclass.awk -v CLASS=ItSetup -v VAR=Language -v VALUE="D" c:\temp\It2001.ini  
	if "%OSLanguage%" == "1033" awk -f c:\Temp\xtoclass.awk -v CLASS=ItSetup -v VAR=Language -v VALUE="GB" c:\temp\It2001.ini  

	xcopy /E/C/I/Q/G/H/R/Y "depot\ItEdit32Setup\*.*" "%PROGRAMFILES%\InfoTip\ItEdit32"  
	xcopy /E/C/I/Q/G/H/R/Y "depot\Itwin32\*.*" "%SystemDrive%\It2001"  
	
	
	copy /D/V/Y/Z  c:\Temp\It2001.ini "%SystemDrive%\It2001\It2001.ini  
	
	copy /D/V/Y/Z  fake.dat "%Windir%\online.dat"  
	copy /D/V/Y/Z  fake.dat "%Windir%\online.prt"  
	copy /D/V/Y/Z  fake.dat "%Windir%\online.bck"  
	

	if "%OSLanguage%" == "1031" (  
	if not exist "%ALLUSERSPROFILE%\Startmenü\Programme\Infotip" mkdir "%ALLUSERSPROFILE%\Startmenü\Programme\Infotip"  
	shortcut -f -t "%PROGRAMFILES%\InfoTip\ItEdit32\ItEdit32.exe" -n "%ALLUSERSPROFILE%\Startmenü\Programme\Infotip\ITEdit32.lnk" -d "%PROGRAMFILES%\InfoTip\ItEdit32"  
	shortcut -f -t "%SystemDrive%\It2001\ITSET32.EXE" -n "%ALLUSERSPROFILE%\Startmenü\Programme\Infotip\ITSET32.lnk" -d "%SystemDrive%\It2001"  
	shortcut -f -t "%SystemDrive%\It2001\It2001.EXE" -n "%ALLUSERSPROFILE%\Startmenü\Programme\Infotip\It2001.lnk" -d "%SystemDrive%\It2001"  
	
	cacls "%PROGRAMFILES%\InfoTip" /t /c /e /g Jeder:F  
	cacls "%SystemDrive%\It2001" /t /c /e /g Jeder:F  
	cacls "%Windir%\online.dat" /t /c /e /g Jeder:F  
	cacls "%Windir%\online.prt" /t /c /e /g Jeder:F  
	cacls "%Windir%\online.bck" /t /c /e /g Jeder:F  
	)
	
	if "%OSLanguage%" == "1033" (  
	if not exist "%ALLUSERSPROFILE%\Start Menu\Programs\Infotip" mkdir "%ALLUSERSPROFILE%\Start Menu\Programs\Infotip"  
	shortcut -f -t "%PROGRAMFILES%\InfoTip\ItEdit32\ItEdit32.exe" -n "%ALLUSERSPROFILE%\Start Menu\Programs\Infotip\ITEdit32.lnk" -d "%PROGRAMFILES%\InfoTip\ItEdit32"  
	shortcut -f -t "%SystemDrive%\It2001\ITSET32.EXE" -n "%ALLUSERSPROFILE%\Start Menu\Programs\Infotip\ITSET32.lnk" -d "%SystemDrive%\It2001"  
	shortcut -f -t "%SystemDrive%\It2001\It2001.EXE" -n "%ALLUSERSPROFILE%\Start Menu\Programs\Infotip\It2001.lnk" -d "%SystemDrive%\It2001"  
	
	cacls "%PROGRAMFILES%\InfoTip" /t /c /e /g Everyone:F  
	cacls "%SystemDrive%\It2001" /t /c /e /g Everyone:F  
	cacls "%Windir%\online.dat" /t /c /e /g Everyone:F  
	cacls "%Windir%\online.prt" /t /c /e /g Everyone:F  
	cacls "%Windir%\online.bck" /t /c /e /g Everyone:F  
	)

popd
:: exit %error%



Inhalt der IT2001.ini:
[ItSetup]
DiskLabel=asset.txt
Language=GB
Country=Deutschland
Country-Code=D
TelToGermany=0
...

[User]
Dealer=...
Name=Mustermann
Street=...
Nation=D
P-Code=20....
City=Hamburg
Phone=.....
Fax=...........
BKZ=
BankName=
KontoNr=
EMail=mustermann@..........
StNr=
InTis-Cu-No=

Content-Key: 125549

Url: https://administrator.de/contentid/125549

Ausgedruckt am: 29.03.2024 um 15:03 Uhr

Mitglied: TomTomBon
TomTomBon 23.09.2009 um 13:32:13 Uhr
Goto Top
Welcher ** findet diese Frage "nicht anspruchsvoll"?
Es ist eine tiefergehende, spezielle Frage auf die ich keine Antwort derzeit habe, und vor ein paar Wochen überhaupt keine Ahnung hätte.

Ein Programmierer würde natürlich sagen das so was eines der leichtesten Dinge wäre.

Das man dann vielleicht sagt "mach mal dies und das" und neg bewertet, ok.

Aber ohne Kommentar - ??


;-(


Mir ist dieses Verhalten bei einigen Vorgängen aufgefallen.