Solved BAT file to create numbered txt lines from user input

January 1, 2012 at 08:42:42
Specs: Windows 7
Here is an example of what i want to create inside a txt file

file=1951023&time=&allpart=01&curpart=1
file=1951024&time=&allpart=01&curpart=1
file=1951025&time=&allpart=01&curpart=1
file=1951026&time=&allpart=01&curpart=1
file=1951027&time=&allpart=01&curpart=1
file=1951028&time=&allpart=01&curpart=1
file=1951029&time=&allpart=01&curpart=1
file=1951030&time=&allpart=01&curpart=1
file=1951031&time=&allpart=01&curpart=1

but i would love to have a bat file the would let me input the first number & last number, or a some sort of bat file i could edit to enter the first & last number, that way NO user input would be required

for example

input 501239
input 501245

then a txt file is created like so

file=501239&time=&allpart=01&curpart=1
file=501240&time=&allpart=01&curpart=1
file=501241&time=&allpart=01&curpart=1
file=501242&time=&allpart=01&curpart=1
file=501243&time=&allpart=01&curpart=1
file=501244&time=&allpart=01&curpart=1
file=501245&time=&allpart=01&curpart=1

if you could help me, i would really appreciate it

many thanks


See More: BAT file to create numbered txt lines from user input

Report •


#1
January 1, 2012 at 10:19:30
✔ Best Answer
Stated there is no DOS in Windows 7, here the NT batch you need.
Be aware no leading zeros are admitted.
At prompt type e.g.gfile 501239 501245 and the file is generated

:: GFILE.BAT Usage: gfile Num_Start Num_End
@echo off & setlocal

set File_Out=Here your Output FileName

if "%1"=="" (echo.Missing Parameter & goto :EOF)
if "%2"=="" (echo.Missing Parameter & goto :EOF)
for /L %%i in (%1 1 %2) do echo.file=%%i^&time=^&allpart=01^&curpart=1>> "%File_Out%"


Report •

#2
January 1, 2012 at 16:05:14
absolutely brilliant, thankyou so much, this is gonna save me hours of work

james


Report •
Related Solutions


Ask Question