Saturday, May 15, 2010

Help making a batch file.?

Trying to make a file in notepad to copy a list of files to another location (keeping filepaths in tact), example is:





textures\house\chimney.dds


textures\barn\hayloft.dds


meshes\tractor\rightwheel.nif





etc.





When done I want to save it as a batch file and run it to copy all these files (something like 800 in the list structured as in above example)

Help making a batch file.?
Batch files can be a handy little ol' thingie.





BUT don't forget they are created with DOS commands (ain't it nice they are so easy to learn?)





But before I show you how, why not type the commands directly from your Command screen?


Like this, (make sure the folders (directories) have been created first on where to put them.)





COPY C:\textures\house\chimney.dds C:\new_folder\new_subfolder\





If you want to do it using a batch files, read on:


Create the following in a plain text program... like Notepad.





Here's how I would do it...


Make sure you have all the "path" locations down pat to make this easy!!!


"Path" being the precise locations where the files are and are to be copied to i.e., C:\textures\house\ and C:\new_folder\new_subfolder





Something like this...


(CD means Change Directory in DOS)


CD C:\ (to bring you to the root directory (folder).


CD C:\textures\house\


COPY *.* C:\folder\sub_folder (this is where it will be placed).





(*.* is wildcard for "everything" in that folder)





For the others all you have to do is change the locations to copy from and change the appropriate folders to where you want them.


PS: make sure the folders (directories) already exist, so create them first.





Dont forget to "save" each batch file as you create them with a good filename and save them with the extension .bat


;-)
Reply:for one file


copy c:\mypath\myfile.txt c:\mydestination





or


for batch


copy c:\mypath\*.txt c:\mydestination
Reply:a batch file has a list of dos commands, it's been ten years since I made one, but I once made a pretty sophisticated menuing program for launching my dos apps and games, using ansi screens and was even able to give it mouse support. I have NO IDEA how to do it again.


but to create a batch file with notepad you have to rename it from a .txt file to a .bat extension. then it will be an executable file.

hiking boots

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.

 
vc .net