yellybird
Goto Top

Batch datei.txt teile auslesen

Hallo zusammen,
ich bin realtiv neu hier und hätte eine kleine Frage:

ich möchte mit einem batchfile aus einer txt datei User und Password zurückgeben lassen.

die datei.txt sieht folgendermaßen aus

mUser=MOR
mPassword=pad34

könnte mir da jemand behilflich sein?
danke im voraus

Content-Key: 265209

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

Printed on: April 16, 2024 at 04:04 o'clock

Mitglied: 114757
114757 Mar 04, 2015 updated at 13:51:19 (UTC)
Goto Top
@echo off & setlocal enabledelayedexpansion
for /f "usebackq tokens=1,2 delims==" %%a in ("c:\textdatei.txt") DO @(  
    if /i "%%a" == "mUser" set "user=%%b"  
    if /i "%%a" == "mPassword" set "pass=%%b"  
)
echo Benutzer: !user!
echo Password: !pass!
Gruß jodel32
Member: yellyBird
yellyBird Mar 04, 2015 at 13:56:43 (UTC)
Goto Top
Danke Schön funktioniert super :D