Batch File Equivalent

G

Guest

OK, I've been in the dark ages apparently.

How do I write the equivalent to a batch file that will run in windows.

Do I want a script? How do you write those?

I want a file that will automatically copy certain files to another location
with the ease of running the batch.

Thanx (I hope).
 
S

Shenan Stanley

Posse said:
OK, I've been in the dark ages apparently.

How do I write the equivalent to a batch file that will run in
windows.

Do I want a script? How do you write those?

I want a file that will automatically copy certain files to another
location with the ease of running the batch.

Batch scripts work fine.
VBScripts..
PowerShell...
Etc...
 
J

John John

Let's walk before we try to run! Do you even know how to copy a file at
the command prompt? Scripts are very powerful when compared to batch
files but they are also more complicated to write. I think it's a very
good idea to learn scripting but I'm wondering if you shouldn't at least
learn a few basic things before you dive head first into the first thing
that you hear of. Consider the following solutions to a simple task:

We want to copy a file named "MyFile.doc" located in "C:\MyFolder" to a
backup folder we call "MyBackUps" on drive "D". We work with the file
every day, it changes all the time, so when we copy the file we want to
overwrite the older copy in the "MyBackUps" folder with the newer version.

The batch file to do the above task:

-----------------------------------------------------------
copy C:\MyFolder\MyFile.doc D:\MyBackUps

-----------------------------------------------------------


Now let's see a (typical) script to do the same thing:

-----------------------------------------------------------
Const OverwriteExisting = TRUE

Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CopyFile "C:\MyFolder\MyFile.doc" , "D:\MyBackUps\",
OverwriteExisting

------------------------------------------------------------

In my opinion scripting is an very valuable skill to acquire, one that
in a certain way can supplant batch writing skills, but I feel that not
knowing at least the basic Command Line commands and basic batch writing
skills is like wanting to drive a Formula 1 race car without even
knowing the difference between automatic and manual transmissions and
not knowing how to change speeds on one or the other!

As good a place as any other to acquaint yourself with these:

http://www.microsoft.com/technet/scriptcenter/default.mspx
http://search.technet.microsoft.com/search/default.aspx?siteId=1&tab=0&query=batch+files
http://search.technet.microsoft.com/search/default.aspx?siteId=1&tab=0&query=commands

John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top