SUBSIM Radio Room Forums

SUBSIM Radio Room Forums (https://www.subsim.com/radioroom/index.php)
-   General Topics (https://www.subsim.com/radioroom/forumdisplay.php?f=175)
-   -   create a windows batch file (https://www.subsim.com/radioroom/showthread.php?t=141616)

jumpy 09-02-08 10:47 AM

create a windows batch file
 
hey all, I need someone who knows how to write a windows batch file to return a list (in a simple .txt file) of a specific file extension (.dwg) in the current directory that the batch file is run from.

I used to have one of these but canot find or remember how to code it.

Can anyone help?

Digital_Trucker 09-02-08 11:29 AM

Code:

dir *.dwg > textfilename.txt
will give you a list of all the files with file extensions of .dwg, but it will also give some extraneous lines at the beginning and end and will list information other than just the file name

jumpy 09-02-08 11:50 AM

hmm, thanks that's the stuff. Any ideas about including subdirectories of the folder that the .bat file is located in?

VipertheSniper 09-02-08 11:51 AM

cmd /C dir /S *.dwg /A > list.txt

This will close the console after it's finished. And also give you the files located in subdirectories... depending on how much there are you'll maybe want to use the the switch /B with the dir command, then you'll only get the paths written to the text file

The command in the batch file would look like this...
cmd /C dir /S /B *.dwg /A > list.txt

Or easier dir /S /B *.dwg > list.txt

That'll close aswell after it has finished

jumpy 09-02-08 12:00 PM

nevermind, I think I've found what I'm looking for thanks to your prompt :up:

Code:

DIR *.DWG /s /b > DWGlist.txt
EDIT:

ahah! there's more lol

jumpy 09-02-08 12:36 PM

I never did learn how to use dos code properly

basic AutoLisp code, now that I can handle (well mostly).

Thanks again :up:

jumpy 09-03-08 04:52 AM

All works according to plan until I try and use it on a network drive, on the console pops up for a split second and complains about UNC something or other.:cry:

Ah well.

VipertheSniper 09-03-08 10:45 AM

Go to the folder you want to execute the *.bat from, then just paste the command of the batch file into the console. The console will stay open, and you can read the error message.


All times are GMT -5. The time now is 04:22 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright © 1995- 2025 Subsim®
"Subsim" is a registered trademark, all rights reserved.