Using batch (.bat) files

  • Thread starter Thread starter Mike375
  • Start date Start date
M

Mike375

Guest
I suppose most people would rarely if ever use them these days.

Here is a little backup one I just completed for copying the data base to 2 external HDs, 2 computers on the network and the sending computers own C:\

c:
cd\ViperTransfer

ren *.mdb Viper.mdb

cd\Documents and Settings\John Chorley\My Documents

copy viper.mdb \ViperTransfer

cd\ViperTransfer

set Day=%Date:~4,2%
set Mth=%Date:~7,2%
set Yr=%Date:~10,4%
set Hr=%Time:~0,2%
set Min=%Time:~3,2%
set Sec=%Time:~6,2%

ren *.mdb Viper%Hr%%Min%%Sec%-%Day%%Mth%%Yr%.mdb

copy *.mdb \\378Wby\mydocuments
copy *.mdb c:\
copy *.mdb j:
copy *.mdb k:
copy *.mdb \\378mike\c
 
Nice,

but what's the difference between a 375 and a 378 ?
 
The 378 is the same bore diameter, just called 378 Wby to be different to the 375 Wby and 375 H&H. However, the 378 is a far larger cartridge, would hold about 50% more powder and velocity with 270 grain bullets is well over 3100 f/s and some reloads will sometimes go over 3200 f/s. So 375 bullets but 300 Winchester and 300 Wby type velocities.
 
Did you use Edlin to make this file? :D
 
Last edited:
No. Edlin is for editing a file using DOS. Line editor:)

To make a file you just name any file with extension .bat.

However, you can kick off in the DOS screen with

Copy con xyx.bat

Type in a line of command. Might be just c\

Then on next line do Ctrl Z and then the return key.

That gives you a .bat file.

Then go to Explorer and find the file and right click and then click Edit. That opens the file in Note Pad and away you go. Much easier than it use to be.

If you want to copy to specific Folders (Directories:)) on the computer from where it is done then

copy *.mdb c:\ViperDaily
copy *.mdb j:\ViperDailyj
copy *.mdb k:\ViperDailyk

The following is doing the backup and using one of the computers on the network to run the backup. The computer listed as 378RoyalCustom is where the complete data base is stored in My Documents

c:
cd\ViperTransfer

ren *.mdb Viper.mdb

copy \\378ROYALCUSTOM\"my documents"\viper.mdb \ViperTransfer

cd\ViperTransfer

set Day=%Date:~4,2%
set Mth=%Date:~7,2%
set Yr=%Date:~10,4%
set Hr=%Time:~0,2%
set Min=%Time:~3,2%
set Sec=%Time:~6,2%

ren *.mdb Viper%Hr%%Min%%Sec%-%Day%%Mth%%Yr%.mdb

copy *.mdb \\378mike\ViperDaily
copy *.mdb c:\ViperDaily
copy *.mdb \\378RoyalCustom\j\ViperDailyj
copy *.mdb \\378RoyalCustom\k\ViperDailyk
copy *.mdb \\378RoyalCustom\ViperDaily

I have two sets of them, one being for when the time is from 12am to 10am and the other from 10am to midnight. The reason is the

set Hr=%Time:~0,2%

When the time has less than 10 hours DOS has a space in front of the number and Copy won't work. Thus for the 12am-10am the Hr set is changed to

set Hr=%Time:~1,1%

That means it starts on the first number after the first number as opposed starting at the start.

I have an invisible/visible on the label that has a macro that runs the .bat file.

The renaming of the data base called Viper comes out as Viper163228-20032008 and that of course is Australian date format.

Mike
 
Last edited:
Sorry, there was supposed to be a smilie after the last entry.
It was a joke about the days of MS-DOS when .bats were the rule rather than the exception.
 
No problem.

I have heaps of .bat files. I suspect I am in the very very very small minority.:D
 
No problem.

I have heaps of .bat files. I suspect I am in the very very very small minority.:D

There is certainly nothing wrong with a batch file.
They seem to have gone out of style.
I won't take a position on whether thats a good or bad thing.
 
They are simple for opening a specfic .xls .doc or .mdb

cd\Letters
ModePayment.xls
 
What's DOS got to do with a bat?:confused:
well other than the Aussies and Kiwis ability to use one properly that is...................
 
I've actually been pondering the idea of using .bat files to deploy updates to my front end file, and while I'm familiar w/ the concept, I'm new to the actual practice.
There is certainly nothing wrong with a batch file.
They seem to have gone out of style.
This has crossed my mind on more than one occasion, and it's got me wondering. Moving forward technology-wise ('cause I figure my company will do it EVENTUALLY, hehe), I know batch files ARE the exception anymore -- so they've already been somewhat phased out. How do things look for future compatibility, though? I know legacy DOS support has been discontinued since XP, but a command prompt still exists in Vista (can't imagine NOT having SOME kind of command prompt), so I don't know how the future will fare for .bat files. Anyone have any word on how widely they're still supported (and will be)?

Also, if/as .bat files are phased out, is there any readily available alternative?
 
Also, if/as .bat files are phased out, is there any readily available alternative?

I have no idea but have always assumed (perhaps incorrectly) that the same thing could be done with Windows. Is their a way to copy etc without using the mouse.

As a side note Windows itself has some .bat files.

I would be interested to know if the following little task could be done from an Access form without using batch files.....I have a bunch of pre prepared Word.docs that are Access/Bookmark done etc. The letters can also be opened from the Access form because we sometimes make changes to the standard letters. After we run the Bookmark Insert/Print/Close Word etc. I click on the little button and that copies a spare of the letter from one directory to the using directory and hence brings the pre prepared letter back to original.

Like yourself I have at times wondered if the .bat files would continue. I got heaps of the little devils:D
 
Reeeee-heeeeee-heeeeeeeeeeally...

As a side note Windows itself has some .bat files.

Well hey, I guess as long as the operating system itself is relying on .bat files, it's safe to say they're still supported, lol. I just sure hope they keep 'em around. The simplest solution is usually the best, and .bats are easily accessible to anyone with a little knowledge, which is a huge plus for me. I just happen to have a little knowledge! And I've got this forum when that runs out, haha
 
One thing for sure and that is they are a 100 times easier to make in Windows than was the case with DOS and becasue of the Edit via Notepad.
 
With XP and above BAT files should really be named CMD as that takes advantage of things that normal BAT files can't do. I can't remember exactly what it was but that's why in my auto updater it builds a cmd file instead of bat file.
 
Bob, I just changed one and all worked fine. The new file type comes up as Windows NT Command Script

I just ran this one. However, it still needed the inverted commas.

cd\

\"Documents and Settings"\"My Name"\"My Documents"\ViperCopy.mdb

Always beats me as you change directories OK in the DOS prompt screen.

As fas as opening files such as Access, Word and Excel I suppose shortcuts have diminished the use of .bat files and of course code. Although if you ony want to open a speficic Word or Excel file and do nothing with Bookmarks or Cells when they open, the .bat file sure is simple.
 

Users who are viewing this thread

Back
Top Bottom