Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I create a batch file ????

Status
Not open for further replies.

neemi

Programmer
May 14, 2002
519
GB
Does anyone know how to create a batch file?

What I have is 2 shortcuts, one for an access mde database, one to compact the database, I also have a workgroup file and the actual mde file.

It has been used for work purposes and so far I have been writing detailed step by step guides on setting up the shortcuts. eg setting the targets, creating new folders and where to place the folders so that they can use the shortcuts through their start menu. However, someone once mentioned a "batch file" to me once.

Does anyone know what it is and how to create it?

Any help appreciated.

Cheers,

neemi
 
A batch file is basically a way of running a series of DOS commands with one command. For example you could run the Hello.bat file to open a .txt file from DOS.
the file would be:

cd..
cd My_Folder
helloworld.txt

now by simply running the hello.bat file these three lines of DOS are ran.

Now I have some sample code that we use to create a .BAT file that takes pictures stored in a temp directory on the hard drive and moves them to the appropriate folder on the server. The .BAT file is created ran and then deleted. I hope all this is helpful.

Dim FileString As String
Dim Files As String

'Creates a temporary batch file
Open "C:\BATCHFILE.BAT" For Output As #1

'gets the filepath from the form
FileString = FilePath

'this batch file is simple one liner move statement
Print #1, "MOVE C:\InspectorPhotographs\* " & FileString
Close #1

'Runs the Batch File
stAppName = "C:\BATCHFILE.BAT"
X = ShellExecute(hwnd, "open", stAppName, "", "c:\AML Files", SW_SHOWNORMAL)

'deletes the batch file
Kill ("C:\BATCHFILE.BAT")

what I would suggest is not deleting the batch file and puting it on the desktop with a that is obvious that it is a shortcut. If you have more specific questions I would be glad to try to answer them.

Happy Hunting

Matt
 
Thanks for your response Matt,

I have no clue as to how to write the batch file for what I need.

If I can have your email address I can email you the set of notes which I have for the user, on setting up the shortcuts and where to place them... and you can tell me if this is possible as a batch file. If you dont mind that is?

What language is the commands written in?

Cheers

neemi
 
The commands are not written in a language. Have you ever used the DOS system? They are just a series of commands. If you search for "MS-DOS Commands" on the web you should be able to to find site on the web that explains in detail the commands and what they do. Yes please e-mail me your notes and I'll try to help you create the file.

Matt

kms@mme.state.va.us
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top