General discussion

Locked

Download: Save time using batch files to perform repetitive tasks

By Mark W. Kaelin Editor ·
http://techrepublic.com.com/5138-10586-729266.html

While batch files are still a viable tool for performing simple day-to-day tasks in a Windows operating system environment, much of their functionality has been supplanted by other scripting languages.

Which do you use more in your day-to-day tasks: batch files or scripts? Can you share an example?

This conversation is currently closed to new comments.

49 total posts (Page 1 of 5)   01 | 02 | 03 | 04 | 05   Next
| Thread display: Collapse - | Expand +

All Comments

Collapse -

batch still rules

by kolossus In reply to Download: Save time using ...

I use batch files to back up the host file and I keep some batfiles in reserve to restore the automatic download and the helpcenter.
Comes quite handy. Maybe I am just an old timer, but I feel they do the job quite well.

Collapse -

25 years of batchin'

by pro-tech In reply to batch still rules

DOS was in its infancy when I got my first IBM clone. If you didn't learn batch language you just couldn't do much with that early PC.
Now I have a website and I have put two very important Batch Files on my website for easy download. They both remove junk files from a PC. Hoover cleans up a win-98,ME PC,and XPCleanup removes all the junk from a Win-XP PC. Download and take a look. Put one in your Startup folder for a daily cleanup.
The Shadow
http://theshadow.members.atlantic.net

Collapse -

You gotta love 'em

by mhasf In reply to 25 years of batchin'

I cannot think of a system that doesn't use batch files in some way. I have been using them since 1979 on RSTS/E machines and continued into my Windows Server 2003 world. Back in the days prior to patch kits, you would have to patch a Novell Server by hand... Not this guy! I wrote batch files for updating servers, so I would not miss anything and more importantly, ensure that everything got copied into backup directories.

In LINUX I guess they're called scripts, and they are invaluable! I think a good IT person ought to be a little lazy so as to be motivated to automate everything. (sounds like an oxymoron, eh?)

Collapse -

Speaking of lazy...

by eliant In reply to You gotta love 'em

See if you can figure out what this BAT file (named COMPF.BAT) did for me in the old days (and even today, once in a great while.)

========
fc /c/n/w %1 %2>compf.lst
========
(scroll down for answer)


With this BAT file in \Windows\Command, you can compare two very similar files (good for locating the differences in version1 and version2 of text files.

Results are dumped to file COMPF.LST in your current directory.

Collapse -

Speaking of lazy #2...

by eliant In reply to You gotta love 'em

Compare the contents of two directories using the following BAT file and typing DIRCOMP DIR1 DIR2 at the command prompt.
=============
dir %1 > c:\temp\dir1.txt
dir %2 > c:\temp\dir2.txt
fc /c/l/n c:\temp\dir1.txt c:\temp\dir2.txt > c:\temp\dircompf.txt
edit c:\temp\dircompf.txt

Collapse -

Lazy Admins

by Jacksonian In reply to You gotta love 'em

Mhasf,

I agree completely with your statement that a "good IT person ought to be a little lazy so as to .. automate things".

My philosophy, a good network admin should never have to leave his chair (unless its for coffee).

My first PC came with DOS 5.0 and alot of the "new generation", to include my colleagues, know nothing about the importance of the command line. I have 100's of scripts in my library and I enjoy the challenge of finding a way to automate every task, not just the mundane, from my little blinking cursor ...

Collapse -

Aha! A kindred spirit!

by somethinggood4 In reply to Lazy Admins

Automation is the way to go! Our office has been undergoing a data revolution over the past two years... Our reporting had been delivered on paper for ever, and when I took over Admin, I set about freeing us from the task of transferring that info to our analysis spreadsheets. That led to a moacro in the spreadsheet program that aoutomated the update process, and a script that automatically runs the macro. Now that we've gone paperless, I'm looking at developing a script (or batch) that will do all of our digital filing for us on a schedule. Lazy? I call it efficient!

Collapse -

Don't need deltree

by BCCCProf In reply to 25 years of batchin'

In XP, RD has a switch /s that replaces deltree.

Removes (deletes) a directory.

RMDIR [/Q] [drive:]path
RD [/Q] [drive:]path

/S Removes all directories and files in the specified directory
in addition to the directory itself. Used to remove a directory
tree.

/Q Quiet mode, do not ask if ok to remove a directory tree with /S

Collapse -

Help

by locedup1 In reply to 25 years of batchin'

Hi there,
I saw that you have 25 years of scripting under your belt, and I have 0. I have never programmed at all. I need some help, badly. I need to create a batch file to FTP information from a Unix server, dump the infor into a specified directory, then say goodbye.

We are basically porting a Unix app to windows, so I need to automate movement of data from one server to another. I am sure that you are porbably laughing, because it may prove a simple task for someone like you.

I would appreciate you pointing me in a direction that may help me accomplish this task.

Thank you very much.

Collapse -

Possible solution to your problem?

by Jacksonian In reply to Help

locedup1,

Try this for your ftp automation. It is a script used to automate the download of antivirus signatures for symantec. You will need 2 files. One is your batch file that will initiate the ftp process and two is the ftp script that will issue commands. I have the batch file listed first, and i included comments to let you know whats happening and how you should modify. I will make my comments using <==, so make sure you remove <== and everything after that (to the right).

=ftp batch file start =========
ftp -s:script.txt <== calls ftp automation
<== enter what you want you want to accomplish
<==after the files are transferred here.

=script.txt start=========
open ftp.symantec.com <== opens an ftp site
anonymous <== username here
nobody@spammer.com <== password here
cd /remote/directory <== change directory (remote)
lcd C:\temp <== change directory (local)
bin <== set binary transfer mode
hash <== show hash symbols during transfer
prompt
get filename.exe <== filename that you want to get
quit <== quit the ftp session

This is just a basic suggestion. You can elaborate as much as you need to. If you need further help with this, shoot me an e-mail at jacksonmn@3mawyuma.usmc.mil.

Hope this helps!

Back to IT Employment Forum
49 total posts (Page 1 of 5)   01 | 02 | 03 | 04 | 05   Next

Related Discussions

Related Forums