Question

return list of folders/file names - MS DOS

Asked by: crompnk

Hi,

Is it possible to have a Windows Batch script that returns a list of folders in a directory or a list of files in a folder as a string.
I would like to be able to use this functionality in a windows batch editor so the user selects which files to copy to another folder.
Or is this best done with a VBS script.

Thanks

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2009-06-25 at 04:16:14ID24521289
Topics

Windows XP Operating System

,

MS DOS

,

Microsoft Windows Operating Systems

Participating Experts
7
Points
500
Comments
34

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. What are batch files and scripts?
    In my mind I keep imagining that I'm an expert but I STILL can't seem to figure out just what in the world batch files and scripts are? I'm to the thinking that I could type out the commands in Windows Notepad and then execute them by clicking on the file? Yes/No? How is i...
  2. Resource Editor, Bulk Paste String Limitation
    I want to use the VB Resource Editor, String Tables to store strings in various Lanuages. I want to edit my string in MS Excel because it is a large table, then paste it back into the String Table. Athough the Resource Editor has an Export function, it has no Import functio...
  3. BATCH FILE
    Hi Does anyone know how to fire a PHP script using a BATCH file? Thanks
  4. Run batch files and query a database with VB Script
    I should preface this with the fact that I do not know VB Script at all, but I think it can do what I need much easier than batch files. I need to: 1. Lookup all the files with a particular extension in a folder on a network share 2. Run 2 batch files for each file in the f...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: Pearl_export_benPosted on 2009-06-25 at 04:21:17ID: 24710165

This is done best in VB Script.

This will do it:

Set objFSO = CreateObject("Scripting.FileSystemObject")
objStartFolder = "C:\Scripts"

Set objFolder = objFSO.GetFolder(objStartFolder)
Set colSubfolders = objFolder.Subfolders
Set colFiles = objFolder.Files

For Each objSubfolder in colSubfolders
   Wscript.Echo objSubfolder.Name
Next

For Each objFile in colFiles
    Wscript.Echo objFile.Name
Next


This will return all folder names and files:

Set objFSO = CreateObject("Scripting.FileSystemObject")
objStartFolder = "C:\Scripts"
 
Set objFolder = objFSO.GetFolder(objStartFolder)
Set colSubfolders = objFolder.Subfolders
Set colFiles = objFolder.Files
 
For Each objSubfolder in colSubfolders
   Wscript.Echo objSubfolder.Name
Next
 
For Each objFile in colFiles
    Wscript.Echo objFile.Name
Next

                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:

Select allOpen in new window

 

by: Pearl_export_benPosted on 2009-06-25 at 04:22:04ID: 24710167

OK - explaining my post time.. i was meant to cut the code into the code window, not copy it, so ignore the code in the main post :)

Ben

 

by: QlemoPosted on 2009-06-25 at 04:31:24ID: 24710228

I don't agree. The same can easily be done in DOS.

If you build a dialog, it gets interesting in VBS, though. Dumping file and folder names into a file, editing it, and start actions depending on the content is neither luxurious nor failsafe at all.

 

by: shadowlesssPosted on 2009-06-25 at 04:33:05ID: 24710235

Here is the cmd prompt...

dir C:\ > c:\contents.txt

If you want to include contents of subfolders use the /s switch with the dir command.

 

by: QlemoPosted on 2009-06-25 at 04:35:32ID: 24710253

shadowless,
that format is not usable for this purpose. You should use
dir /s/b > c:\contents.txt
at least.

 

by: Pearl_export_benPosted on 2009-06-25 at 04:36:00ID: 24710260

Very true - this can be done in command line.  I still prefer VB though as you can build a prompt around it for starting folders, can just get the folder and file names without having to use loads of switches etc.  Either way both solutions work fine :)

 

by: QlemoPosted on 2009-06-25 at 04:38:25ID: 24710273

I reckon working on the "select" part would be what we should do.

 

by: Pearl_export_benPosted on 2009-06-25 at 04:41:12ID: 24710296

Set objFSO = CreateObject("Scripting.FileSystemObject")
objStartFolder = InputBox( "Enter Your Start Path")
 
Set objFolder = objFSO.GetFolder(objStartFolder)
Set colSubfolders = objFolder.Subfolders
Set colFiles = objFolder.Files
 
For Each objSubfolder in colSubfolders
   Wscript.Echo objSubfolder.Name
Next
 
For Each objFile in colFiles
    Wscript.Echo objFile.Name
Next

 

by: crompnkPosted on 2009-06-25 at 06:17:10ID: 24711041

Hi,

Thanks for the help.

Will this script work in a batch file, I created a batch file with the VBS code and recieved the following error:



C:\Temp\Test>Set objFSO = CreateObject("Scripting.FileSystemObject")

C:\Temp\Test>objStartFolder = "C:\Temp\Test\"

C:\Temp\Test>Set objFolder = objFSO.GetFolder(objStartFolder)

C:\Temp\Test>Set colSubfolders = objFolder.Subfolders

C:\Temp\Test>Set colFiles = objFolder.Files
C:\Temp\Test>For Each objSubfolder in colSubfolders



How would I out put the string to a file.

Thanks

 

by: crompnkPosted on 2009-06-25 at 06:37:18ID: 24711234

Hi,

Can I create the VBS script in a Batch file as so, is this correct, except I got an error <Unexpected 'Next'>:

REM The following VBScript will give a list of the files in the folder
set tmpVBS=%2\CreateFileList.vbs
 
echo Set objFSO = CreateObject("Scripting.FileSystemObject") > %tmpVBS%
echo Set objStartFolder = "{ctrl::OrigWorkspacePath}" >> %tmpVBS%
echo Set objFolder = objFSO.GetFolder(objStartFolder) >> %tmpVBS%
echo Set colSubfolders = objFolder.Subfolders >> %tmpVBS%
echo Set colFiles = objFolder.Files >> %tmpVBS%
echo 'For Each objSubfolder in colSubfolders  >> %tmpVBS%
echo Wscript.Echo objSubfolder.Name >> %tmpVBS%
echo Next >> %tmpVBS%
echo 'For Each objFile in colFiles >> %tmpVBS%
echo Wscript.Echo objFile.Name >> %tmpVBS%
echo Next >> %tmpVBS%
 
REM Execute the script file
call %tmpVBS%
 
REM Clean up after execution
del %tmpVBS%

                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:

Select allOpen in new window

 

by: Pearl_export_benPosted on 2009-06-25 at 07:22:12ID: 24711662

this is to be saved to a vbs file, not a batch file.  copy the code into notepad and save it as "test.vbs" or whatever (with a .vbs extension, not a batch file one)

 

by: AmazingTechPosted on 2009-06-25 at 07:30:04ID: 24711727

crompnk,

I guess we don't really understand what you are trying to do because the vbs script provided only displays folders and then files. The current vbs code only lists 1 folder depth.

Batch file version:

Set /p StartFolder=Enter Your Start Path: 
 
dir /b /ad "%StartFolder%"
dir /b /a-d "%StartFolder%"

                                              
1:
2:
3:
4:

Select allOpen in new window

 

by: crompnkPosted on 2009-06-25 at 07:55:24ID: 24712005

Hi,

The attached vbs script will display the files in the folder specified in the script.
I can run the vbscript from a bat file like so:

REM Execute the vbscript file
test.vbs

In the code I posted before I was trying to create the vbscript and run it in the same bat file or windows batch script.
I wanted to be able to pass a dir to the script using the windows batch editor and ultimately print a string of file names within that dir/folder

Thanks

  • test.vbs.txt
    • 369 bytes

    vbscript to get file names in a folder

 

by: AmazingTechPosted on 2009-06-25 at 08:00:49ID: 24712067

Do you really care if it is a vbscript file or just a batch file?

Save the code as .cmd or .bat like Getinfo.cmd

getinfo c:\temp\test

Use quotes around paths with spaces.

getinfo "c:\Program Files"

dir /b /ad %1
dir /b /a-d %1
                                              
1:
2:

Select allOpen in new window

 

by: AmazingTechPosted on 2009-06-25 at 08:06:37ID: 24712130

Save the code as test.vbs

In you batch file

REM Execute the vbscript file
test.vbs %1

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set Args = WScript.Arguments
objStartFolder = Args(0)
 
Set objFolder = objFSO.GetFolder(objStartFolder)
Set colSubfolders = objFolder.Subfolders
Set colFiles = objFolder.Files
 
For Each objSubfolder in colSubfolders
   Wscript.Echo objSubfolder.Name
Next
 
For Each objFile in colFiles
    Wscript.Echo objFile.Name
Next

                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:

Select allOpen in new window

 

by: AmazingTechPosted on 2009-06-25 at 08:07:59ID: 24712149

Or maybe your batch file was going to call multiple directories?

test.vbs C:\temp\test
test.vbs "C:\Program Files"

 

by: jcimarronPosted on 2009-06-25 at 14:14:15ID: 24716111

crompnk--Rather than reinvent the wheel, I use the very versatile Karen's Directory Printer
http://www.karenware.com/powertools/ptdirprn.asp

 

by: BillDLPosted on 2009-06-26 at 05:33:56ID: 24720272

crompnk

I'm puzzled.  Not by others' suggestions thus far, but by what you stated in your question:
"I would like to be able to use this functionality in a windows batch editor so the user selects which files to copy to another folder."

Qlemo picked up on the "user SELECTS which files..." when he simply said:
"I reckon working on the 'select' part would be what we should do", and AmazingTech also stated: "I guess we don't really understand what you are trying to do...".

The part that puzzles me is where you have more recently explained:
"I wanted to be able to pass a dir to the script using the windows batch editor and ultimately print a string of file names within that dir/folder."  That is quite different from how it sounded at the outset, and I'm wondering if this has reached a partial solution but there is more to come.

I'm sorry if I'm sounding a bit dim here, but I don't understand what you mean by the "select", and either displaying to screen or redirecting a list of file names to a file doesn't seem to be fulfilling what you SEEMED to have asked at the outset.

When you refer to "batch editor", are you simply referring to a "batch file"?

I've read the question and all comments several times, and it still seems to me that you are ultimately hoping to get some kind of file selection method, whether it be from one or more input dialogs shown by a VB Script, or by filtering the output of a batch file.

My understanding of the requirements, especially going on your references to "string of file names" and "as a string", is that you are looking to get a STRING comprising a number of file names as a variable for re-use in a COPY command.  ie. a list all on one line rather than a list on separate lines.

Please can you put me out of my misery ;-)

 

by: crompnkPosted on 2009-06-26 at 06:55:27ID: 24720943

Hi,

Sorry for confusing you.
I originally asked if a batch command that would give me a string of folders or files, so for example if the folder was C:\Temp\Test and the files in that folder were:
Test.txt
Test2.txt
Test3.txt

Then the string would be 'Test.txt,Test2.txt,Test3.txt'

The reason I want this is becasue the editor I have is compatable with Windows Batch Script and TSQL. The editor has an interface, which has a control that lets a user select a path (dir) that can be passed to another command to copy files (or something else if needed). This is fine and I can get this working with an easy command, but I wanted the string of files so another control on the interface can list the files that the user can select from if required (only wants to copy certain files).
As the editor is compatable with sql I was thinking I could return the string using an sql statement that calls/uses a batch script/vbscript.

The experts came back with a vbs script that works, but doesn't return a string. It seems to be more complicated than I thought, I was hoping to have a windows batch script or vbscript that returns a string that the tsql could read and print.

I'm not re-inventing the wheel, but rather adding new functionality to an existing interface that is connected to a sql server db.

Thanks for the help and feedback.

 

by: AmazingTechPosted on 2009-06-26 at 07:53:16ID: 24721555

Thanks for the clarification.

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set Args = WScript.Arguments
objStartFolder = Args(0)
 
Set objFolder = objFSO.GetFolder(objStartFolder)
Set colSubfolders = objFolder.Subfolders
Set colFiles = objFolder.Files
 
For Each objSubfolder in colSubfolders
   Names = Name + objSubfolder.Name + ","
Next
 
For Each objFile in colFiles
   Names = Name + objFile.Name + ","
Next
 
wscript.echo Left(Names, Len(Names) - 1)

                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:

Select allOpen in new window

 

by: AmazingTechPosted on 2009-06-26 at 07:53:52ID: 24721568

Opps. Use this one.

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set Args = WScript.Arguments
objStartFolder = Args(0)
 
Set objFolder = objFSO.GetFolder(objStartFolder)
Set colSubfolders = objFolder.Subfolders
Set colFiles = objFolder.Files
 
For Each objSubfolder in colSubfolders
   Names = Names + objSubfolder.Name + ","
Next
 
For Each objFile in colFiles
   Names = Names + objFile.Name + ","
Next
 
wscript.echo Left(Names, Len(Names) - 1)
                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:

Select allOpen in new window

 

by: BillDLPosted on 2009-06-26 at 07:57:17ID: 24721607

Thank you for the explanation crompnk.  That clarifies what I thought I was reading, ie. the string of file names.

I will try and figure a way to do this from a batch file, but I'm pretty sure the previous contributors will beat me to it because I must humbly admit that they are far more experienced with batch files than I am.  I was really just trying to get a clearer picture of the requirements for everyone's information.

OK guys, how to parse a dir /a-d /b output into a comma-separated text string?

crompnk: can the string be tab or space-separated and double-quoted, or does it have to be comma-separated?

While awaiting your feedback I was quickly messing with a thought that I could create a "file picker" in the CMD window by:

1. Using a FOR command on the results of the DIR /a-d /b /s command (using %%~nxA modifier to output name and extension only perhaps)
2. Pipe results to a FIND /n command (finding the file extension separator dot) to output a list of file names preceded by [1] [2] etc.
3. Prompt the user to enter the numbers against chosen file names
4. FIND each of the lines with matching [1] [2] [3] etc
5. Strip off the [number] from each line leaving file name only
6. Create a string containing comma, tab (or other delimiter) file names as a variable
7. Execute the COPY command passing the variable to provide the parameters.

I did something along these lines years ago in old 16-bit C and Assembly Language for my college exam, so I thought I might make the idea work in DOS.  I was having some success, but I am not sure if I will complete it, nor whether it will be usable in your scenario.  I'll look again later as I need to sleep now.

 

by: AmazingTechPosted on 2009-06-26 at 07:58:57ID: 24721623

Commands with only using a batch file.

You can pipe it to a file.

ECHO !Names:~0,-1!>DirListing.txt

SETLOCAL ENABLEDELAYEDEXPANSION
Set Names=
for /f "tokens=*" %%a in ('dir /b /ad "%~1"') do Set Names=!Names!%%a,
for /f "tokens=*" %%a in ('dir /b /a-d "%~1"') do Set Names=!Names!%%a,
ECHO !Names:~0,-1!

                                              
1:
2:
3:
4:
5:

Select allOpen in new window

 

by: BillDLPosted on 2009-06-26 at 08:00:15ID: 24721642

There you go ;-) See what I mean?  Outclassed by the real experts.

 

by: JT92677Posted on 2009-06-26 at 08:01:44ID: 24721650

jcimarron wrote

"Rather than reinvent the wheel, I use the very versatile Karen's Directory Printer
http://www.karenware.com/powertools/ptdirprn.asp"

I also didn't understand the question asked, but I really like this utility. It has a lot of options regarding what to print, or better, save to a file.

One of the side benefits experts opinion is to find utilities like this one.

 

by: BillDLPosted on 2009-06-26 at 08:02:19ID: 24721656

It's that old DelayedExpansion thing again.  I keep forgetting that.

 

by: AmazingTechPosted on 2009-06-26 at 08:02:31ID: 24721658

Need double quotes?

SETLOCAL ENABLEDELAYEDEXPANSION
Set Names=
for /f "tokens=*" %%a in ('dir /b /ad "%~1"') do Set Names=!Names!"%%a",
for /f "tokens=*" %%a in ('dir /b /a-d "%~1"') do Set Names=!Names!"%%a",
ECHO !Names:~0,-1!
                                              
1:
2:
3:
4:
5:

Select allOpen in new window

 

by: BillDLPosted on 2009-06-26 at 08:06:24ID: 24721696

JT92677
Karen Kenworthy has a few pretty useful and free utilities that I use all the time (including the one mentioned) such as "Replicator" and "Decombobulator".  This is where I pick up url's for little utilities too :-)

 

by: crompnkPosted on 2009-06-26 at 08:11:40ID: 24721749

Hi BillDL,

The string doesn't have to be comma delimited, it can be double quoted.

Thank you

 

by: AmazingTechPosted on 2009-06-26 at 08:17:43ID: 24721823

Need a way to choose from a list?

@ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION
Set Names=
for /f "tokens=*" %%a in ('dir /b /ad "%~1"') do Set Names=!Names!"%%a",
for /f "tokens=*" %%a in ('dir /b /a-d "%~1"') do Set Names=!Names!"%%a",
 
echo.
 
:Menu
Set Line=1
for %%a in (%Names:~0,-1%) do ECHO !Line! - %%a & Set /a Line+=1
set /a Line-=1
 
echo.
Set Choice=
Set /p Choice=Please enter the number of the folder/file: 
echo.
If not defined Choice GOTO End
if !Choice! GEQ 1 if !Choice! LEQ !Line! GOTO ChoiceOK
 
ECHO Please enter a number from 1 to !Line!
PING -n 3 127.0.0.1>NUL
GOTO Menu
 
:ChoiceOK
Set Line=1
for %%a in (%Names:~0,-1%) do If !Line! == !Choice! (ECHO You have chosen %%a & Set Line=-99999) ELSE (Set /a Line+=1)
 
:End
echo.
Echo Finished

                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:

Select allOpen in new window

 

by: JT92677Posted on 2009-06-26 at 11:52:01ID: 24723754

Amazing Tech

Indeed, very clever stuff you come up with, and some of the other EEs in this DOS area, and I thought I was pretty good at DOS, but I've never tried to get BAT files to do any of the things you're able to force out of the various DOS level commands.

Amazing Tech and others -- Now I have to go back and read some of the other solutions you folks have posted, I'm very impressed.

Thanks for the great posts !!!

Jeff

 

by: BillDLPosted on 2009-06-27 at 00:41:16ID: 24726678

AmazingTech
Don't you get fed up with the adulation?  If not, then I'm impressed as always at the deceptively simple but very clever use of "DOS's" limitations.  If cars had never been invented, I'm sure you could have tweaked a triangular-wheeled bicycle to go at 120 mph :-)

I had to use too many workarounds and temp filter files in my much less clever "file picker" batch menu system before you reminded me of Delayed Expansion and had me kicking myself.

crompnk

I'm sure that you will find a working solution from AmazingTech's suggestions to suit your needs.  The secret (in Windows XP Batch) to getting a list of files or folders on one line rather than as a DIR listing on separate lines is with the extremely useful EnableDelayedExpansion.

To read more about how it works, type SET /? in a command window and page down about 4 screenfulls.

Thanks for some more great methods, AmazingTech.

 

by: AmazingTechPosted on 2009-06-27 at 21:35:41ID: 24730128

Things like this is really easy for me so I really can't see what's the big deal. But thanks for all your appreciation. I always try to make things simple. I hope if I keep it simple others will learn and be able to make their own modifications.

There are also a lot of great experts here and I too have learned things along the way.

For each question I usually start from scratch that really helps in learning the syntax and figuring out new ways to tackle a problem.

 

by: BillDLPosted on 2009-06-29 at 05:52:06ID: 24735638

Thank you crompnk :-)

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...