Word :    Username :           
 

Archived from groups: microsoft.public.windowsxp.general (More info?)

 

I have a text file with a list of names, I would like to redirect this file
somehow to the md/mkdir command so that it will read the file and make a
directory for each entry in the text file..

Is this possible? If so how do i go about doing something like this. Thanks.

Sponsored Links
Register or log in to remove.

Archived from groups: microsoft.public.windowsxp.general (More info?)

 

I would copy and paste the md command into the column before all the names
then save it as a .bat file. Copy the .bat file to the root of the drive I
want these folders in and execute the bat file.


"Adrian" <Adrian@discussions.microsoft.com> wrote in message
news:02D694FA-E55D-42F2-BAF2-87C3B664D25E@microsoft.com...
>I have a text file with a list of names, I would like to redirect this file
> somehow to the md/mkdir command so that it will read the file and make a
> directory for each entry in the text file..
>
> Is this possible? If so how do i go about doing something like this.
> Thanks.

Reply to Anonymous

Archived from groups: microsoft.public.windowsxp.general (More info?)

 

I'm not sure if there are any loops allowed in batch files. You could do it
using an AutoIT script (http://www.autoitscript.com/autoit3/index.php) which
is really simple. Just replace names.txt with whatever your text file is,
and it will read in all the file one line at a time, and then create a
directory with that name (from wherever the script is run. AutoIT is a free
scripting language used to automate installs and other things.

;*****Beginning of Program*****
#include <array.au3>
#include <file.au3>
#include <string.au3>
Dim $names
_FileReadToArray("names.txt",$names)

For $i=1 to $names[0]
$val=DirCreate(StringStripCR($names[$i]))
Next
;*****End of Program*****


"Adrian" wrote:

> I have a text file with a list of names, I would like to redirect this file
> somehow to the md/mkdir command so that it will read the file and make a
> directory for each entry in the text file..
>
> Is this possible? If so how do i go about doing something like this. Thanks.

Reply to Anonymous

Archived from groups: microsoft.public.windowsxp.general (More info?)

 

"Adrian" <Adrian@discussions.microsoft.com> wrote in message
news:02D694FA-E55D-42F2-BAF2-87C3B664D25E@microsoft.com...
> I have a text file with a list of names, I would like to redirect this
file
> somehow to the md/mkdir command so that it will read the file and make a
> directory for each entry in the text file..
>
> Is this possible? If so how do i go about doing something like this.
Thanks.

This is quite easy:

@echo off
for /F %%a in (c:\DirList.txt) do md %%a

or, if your names contain embedded spaces:

@echo off
for /F "tokens=*" %%* in (c:\DirList.txt) do md "%%*"

Reply to Anonymous

Archived from groups: microsoft.public.windowsxp.general (More info?)

 

Batch files under Win2000/XP are surprisingly powerful. They
allow loops, if/then/else statements, string manipulation and lots
more. The only problem is that they are totally unstructured.


"Jason Ryon" <JasonRyon@discussions.microsoft.com> wrote in message
news:387E32C9-2BB5-41CF-8DD7-9F14E3DE0320@microsoft.com...
> I'm not sure if there are any loops allowed in batch files. You could do
it
> using an AutoIT script (http://www.autoitscript.com/autoit3/index.php)
which
> is really simple. Just replace names.txt with whatever your text file is,
> and it will read in all the file one line at a time, and then create a
> directory with that name (from wherever the script is run. AutoIT is a
free
> scripting language used to automate installs and other things.
>
> ;*****Beginning of Program*****
> #include <array.au3>
> #include <file.au3>
> #include <string.au3>
> Dim $names
> _FileReadToArray("names.txt",$names)
>
> For $i=1 to $names[0]
> $val=DirCreate(StringStripCR($names[$i]))
> Next
> ;*****End of Program*****
>
>
> "Adrian" wrote:
>
> > I have a text file with a list of names, I would like to redirect this
file
> > somehow to the md/mkdir command so that it will read the file and make a
> > directory for each entry in the text file..
> >
> > Is this possible? If so how do i go about doing something like this.
Thanks.

Reply to Anonymous

Archived from groups: microsoft.public.windowsxp.general (More info?)

 

of corse you can do loops in batch files:

FOR %A IN (list) DO command [ parameters ]

Now, whether you can make a list of directory names in another file and
then pipe them into the command using the pipe and % variables tokens
is debateable.

If the list doesnt vary, simpler to just write a load of MKDIR commands
in a batch file. If the list does vary, then the above solution is the
only way, but its complicated.

look at http://www.robvanderwoude.com/index.html for a detailed
explanation.


--
guestfromhell
------------------------------------------------------------------------
guestfromhell's Profile: http://www.iamnotageek.com/member.php?userid=12490
View this thread: http://www.iamnotageek.com/showthread.php?t=1819079249

Reply to Anonymous
Tom's Hardware > Forum > Windows XP > Windows XP General Discussion > Batch File Question
Go to:

There are 920 identified and unidentified users. To see the list of identified users, Click here.

Please mind

You are about to answer a thread that has been inactive for more than 6 months.
If you still wish to proceed, please ensure that your posting is original and does not duplicate or overlap any prior responses to this thread.

Add a reply Cancel
Sponsored links
  • Ask the community now
  • Publish
Ad
They won a badge
Join us in greeting them