This code , which is basically created "createdtxt.txt" text file that writes each files location
dir /s/b D:\mypictures\*.JPG >createdtxt.txt
would give me a file createdtxt.txt with these lines
D:\mypictures\DSC07861.JPG
D:\mypictures\DSC07870.JPG
D:\mypictures\DSC07871.JPG

HOW can i add simple command into this code that would give the name John before each line example:

John D:\mypictures\DSC07861.JPG
John D:\mypictures\DSC07870.JPG
John D:\mypictures\DSC07871.JPG

Hey There,

I'm not sure if this is the right forum for this question, but I think it is, so apologies to the mods if I'm answering something I shouldn't be.

You can do a for loop in windows bat files like this:

Format is:

for %VAR in (REGULAR_EXPRESSION) do WHATEVERYOUWANTTOTHEREGEXP

for %x in (*LOG*) do echo JOHN dir %x >> BOG.LOG

Obviously, just change it to suit your needs.

Best wishes,

Mike

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.