|
Answer» Hi, I have been looking for a way to do the following :
I have a text file, for example MyTextFile.txt containing the text :
C:\File1 C:\File2 C:\File3
within a batch file, i want to retrieve what is contained in MyTextFile.txt and generate a string which looks like this : C:\File1;C:\File2;C:\File3
in order to subsequently LAUNCH a command using this as argument.
in a way, this amounts to reading MyTextFile.txt and REPLACING end-of-lines by semicolumns. i was not able to do this in my batch.
any ideas ?
Code: [Select]@echo off for /f "tokens=* delims=" %%x in (MyTextFile.txt) do ( call set strArg=%%strArg%%;"%%x" ) set strArg=%strArg:~1%
strArg CONTAINS your data.
Welcome to COMPUTER Hope. Please do a search before posting your questions. As it happens, a very similar question was posted earlier this morning.
|