Forum Moderators: phranque

Message Too Old, No Replies

What's a good replacement for batch files?

Using batch files to perform some functions.

         

HughMungus

7:11 pm on Oct 17, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm using batch files to perform some functions here on my local box such as converting files from wav to mp3, rename files based on the date, FTP functions (create directories on a remote web server, upload files), update blog links using python, send emails (emailsmtp), and update the databasae (using ineturl and an http string + a page on the webserver that updates the db based on what's in the http string).

Anyway, I'm wondering if there's a better way of doing this than using batch files. Perl maybe? The way I'm doing it now works, but, wondering if there's a better way. Thanks!

encyclo

1:59 am on Oct 18, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If it ain't broke... ;)

You could use something like Perl to do the same thing - but you're not going to gain much by switching. Batch files on Windows are like shell scripts on Unix - simple, down-to-earth scripting for mundane tasks.

Perhaps the question should be: what can't you do with batch files that you'd like to do using another method?

HughMungus

4:24 pm on Oct 19, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



True. It ain't broke. Just seems kinda klunky. When I move over to a Linux host I might change some of the functions to occur on the server rather than locally. I just thought maybe something like Visual Basic would be better.

jezra

5:19 pm on Oct 19, 2004 (gmt 0)

10+ Year Member



If this is about a move to a Linux host, then you are going to need to write your scripts so that they can be interpreted on the server in which case, I would suggest Perl, Python, or PHP. All three of these can be installed on Windows and has its advantages and disadvantages. Personally, I use PHP as my scripting language of choice because I know it well from web development. I create and test my scripts on Mac OS X and then deploy them on my Win2k server with very little change. You mentioned using Python to update blog links, if you are familiar with the language, perhaps that is the best route to take.

jezra

HughMungus

7:01 pm on Oct 20, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If this is about a move to a Linux host

Thanks, but, it's not just about the move. Moving to a Linux host is somewhat incidental (I thought there might be some php functions that can send data back down to the local machine somehow). The goal is to do what I'm doing on my local box now in a better way. I'm not using the local box to emulate a web server; I'm using the local box to take incoming phone calls, convert them to .mp3, do some database updates, etc. Those functions currently require batch files and I'm wondering if there's a better way to do it than that (like I said, maybe visual basic or something). Just don't want to use the wrong tool for the job so I thought I'd ask the tool experts. :D

wackal

9:09 pm on Oct 20, 2004 (gmt 0)

10+ Year Member



try looking into windows script components. sounds like they are what you're looking for to do stuff on your local machine

HughMungus

5:42 pm on Oct 21, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yeah, I'm looking at that. What's the difference between Windows Scripting Host and VB Script?

HughMungus

6:02 pm on Oct 21, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Oops I just found the answer to my own question:

[windows.oreilly.com...]