•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Shell Scripting section within the Software Development category of DaniWeb, a massive community of 428,225 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,271 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Shell Scripting advertiser: Programming Forums
Views: 419 | Replies: 1
![]() |
•
•
Join Date: Jul 2008
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
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
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
•
•
Join Date: Oct 2007
Posts: 275
Reputation:
Rep Power: 1
Solved Threads: 26
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
Obviously, just change it to suit your needs.
Best wishes,
Mike
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
Linux and Unix Tips, Tricks and Individual Advice - The Linux and Unix Menagerie!
------------------------------------------------------------------------
Having trouble passing cert exams? Check out How To Pass Any Computer Certification Test!
------------------------------------------------------------------------
Having trouble passing cert exams? Check out How To Pass Any Computer Certification Test!
![]() |
•
•
•
•
•
•
•
•
DaniWeb Shell Scripting Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Running xsltproc batch file from vb.net app (VB.NET)
- Help with a simple script to automate batch file generation (Python)
- simple batch (C)
- how to make a simple script? (C++)
- Java IDE(s) (Java)
- C++ system() (C++)
- passing parameters in bat file (Visual Basic 4 / 5 / 6)
- how do i make executable (Java)
- Simple Download To Fix QBasic on WinXP (Legacy and Other Languages)
- NEQ not working for IF command?! (Computer Science and Software Design)
Other Threads in the Shell Scripting Forum
- Previous Thread: tar issues...
- Next Thread: .bat - Direct stdout to console AND file


Linear Mode