motorcross
Goto Top

Per Batch ein bestimmtes Word aus einer txt.Datei als Variabele setzten

Hallo Administratoren,

ich möchte per Batch Datei ein Wort aus einer .txt Datei als Variabele setzten.
Das wort befindet sich in der ersten Reihe und ist das 6 Wort.
Dieses Wort ist eine Zahl.
Gruß Motorcross

Content-ID: 116523

Url: https://administrator.de/forum/per-batch-ein-bestimmtes-word-aus-einer-txt-datei-als-variabele-setzten-116523.html

Ausgedruckt am: 09.04.2025 um 16:04 Uhr

bastla
bastla 21.05.2009 um 11:03:16 Uhr
Goto Top
Hallo Motorcross!

Etwa so:
@echo off & setlocal
set /p Zeile=<"D:\Die Datei.txt"  
for /f "tokens=6" %%i in ("%Zeile%") do set "Zahl=%%i"  
echo %Zahl%
Grüße
bastla

[Edit] @77559:
heh bastla heute bin ich wohl der Haase face-sad
Aber nur ganz ausnahmsweise ... face-wink
[/Edit]
77559
77559 21.05.2009 um 11:07:02 Uhr
Goto Top
Sag mal Motorcross,

du hast doch jetzt schon so viele Hinweise bekommen.
Wird es nicht langsam Zeit, das du dich selber mal kreativ mit den einzelnen Befehlen auseinandersetzt?

@echo off
set /P Zeile=<Datei.txt
for /f "tokens=6" %%A in ("%Zeile%") do set Wort=%%A  

Gruß
LotPings

Edit Fehler entfernt, heh bastla heute bin ich wohl der Haase face-sad