Unoffical empeg BBS

Quick Links: Empeg FAQ | RioCar.Org | Hijack | BigDisk Builder | jEmplode | emphatic
Repairs: Repairs

Topic Options
#116946 - 18/09/2002 12:47 Scripting in Windows 2000, any advice?
Burgin
stranger

Registered: 11/08/2001
Posts: 47
I don't really have a specific question here. Are there any general guidelines on things like error checking and working with strings, long path names and folders with spaces between them, etc, when working with BAT files? Are there any hidden, or undocumented features in the CMD.exe shell?

I know that Unix is more powerful in this regard. Would that CygWin give me some more capabilities?

Top
#116947 - 18/09/2002 13:04 Re: Scripting in Windows 2000, any advice? [Re: Burgin]
tfabris
carpal tunnel

Registered: 20/12/1999
Posts: 31596
Loc: Seattle, WA
You'd be surprised how much you can accomplish with batch files in Windows NT variants. I've done a lot of work in this area.

Batch files in Windows don't really compare to proper scripting in Unix-based operating systems, they are a poor substitute. However you can often get a lot done with them.

Another option is to use a scripting engine like WinBatch, but long ago I came to the realization that as soon as I needed to move to something as big as WinBatch, I might as well just code up something in Visual Basic and be done with it.

If you could be more specific about what you're trying to get done, perhaps I could give pointers. Make sure to include details of which platforms it needs to run on. Because often the behavior of a given batch file will be different between NT and 98.
_________________________
Tony Fabris

Top
#116948 - 18/09/2002 21:05 Re: Scripting in Windows 2000, any advice? [Re: Burgin]
wfaulk
carpal tunnel

Registered: 25/12/2000
Posts: 16706
Loc: Raleigh, NC US
I don't have time to find it all right now, as I'm tired and I seldom use it, but check out Windows Scripting Host. It's a MS product that's probably in your OS right now that allows you to script stuff using VBScript and Java/J/ECMA script and some other stuff, too. It's worked well for me when I've needed to script stuff in Windows.
_________________________
Bitt Faulk

Top
#116949 - 19/09/2002 06:16 Re: Scripting in Windows 2000, any advice? [Re: wfaulk]
andy
carpal tunnel

Registered: 10/06/1999
Posts: 5916
Loc: Wivenhoe, Essex, UK
I agree about WSH, it is very useful for calling COM objects and moving files around. It is not particularly useful though if you need to call a bunch of command line tools, you are better off using .bat files in that case.
_________________________
Remind me to change my signature to something more interesting someday

Top
#116950 - 19/09/2002 06:58 Re: Scripting in Windows 2000, any advice? [Re: tfabris]
Burgin
stranger

Registered: 11/08/2001
Posts: 47
I thought of something specific. One of the things I've always wanted is some way to do a simple search and replace with strings and something that can do this with a bunch of files in the same directory.


Top
#116951 - 19/09/2002 07:11 Re: Scripting in Windows 2000, any advice? [Re: Burgin]
andy
carpal tunnel

Registered: 10/06/1999
Posts: 5916
Loc: Wivenhoe, Essex, UK
Ah, if you want to do sort of think on a regular (or even occasional) basis then grab yourself a copy of TextPad http://www.textpad.com/index.html

It has great "search and replace across multiple files" functionality, I use it whenever I need to change something en masse in large websites (unless I can be bothered to knock up a perl script to do it instead).
_________________________
Remind me to change my signature to something more interesting someday

Top
#116952 - 19/09/2002 10:18 Re: Scripting in Windows 2000, any advice? [Re: Burgin]
tfabris
carpal tunnel

Registered: 20/12/1999
Posts: 31596
Loc: Seattle, WA
One of the things I've always wanted is some way to do a simple search and replace with strings and something that can do this with a bunch of files in the same directory.

Provided that the files are pure ASCII text, it's possible to do this from batch files with small command-line programs such as CHANGE.COM and FIX.EXE. But as was said, a simple search-and-replace-in-files can be done much easier with any of the advanced editors like Textpad and Ultraedit. Unless you need the search-and-replace feature to be automated, the GUI interface of those programs is much easier to use.
_________________________
Tony Fabris

Top