".....that I was never taught in school"
Just a batch thread for discussing some things that might be good to know, especially before you take up Batch writing.
1. Dos memory is small. It can be inflated, but this is not usually recommended. Environment variables, IE, any variables you assign, seem to have the least space. I've had errors after just assigning 8 or 10 variables in a batch.
1.a. There are several ways to expand the memory. Actually dozens. MANY of them don't work on all versions of windows, which is why it's best to avoid these kind of solutions if you can. Some of these include 'Create a shortcut to the batch and then use the properties tabs to assign the memory spaces' : wrong, doesn't work in NT or XP. Or, 'change the shell environment' : wrong, you don't want to go messing with people's machine settings if you can help it. Besides which, these things are difficult to do and know where to do.
1.b. The one method that does seem to apply to all modern DOS, from what I can tell, is "command /C batchfile.bat /E:nnnnn" where n is a number between 160 and something bigger. Dos is typically run with only 256k available, so beefing that up to 1048 or higher is accpetable. the /C is to make it work like a 'call', and return to the line in the existing batch when the called batch is finished. The caveat here is that, though this works, it didn't help me with gaining more environment-variable space anyways. I had to use fewer variables. But it might help you.
2. Dos versions vary across all the windows environements. There are commands available to XP and NT users that will not work on earlier versions without installing extra files into your core directories.
3. Desipite #2, most of the best commands are available to machines with any version of Windows. Just avoid things like 'Choice' and some of the low level stuff such as modifying Command.com or things like that.
4. DOS is not Perl. There are only 10 native batch commands. 10! . Then there are another handful of DOS commands. Don't go writing real scripting with DOS. There's no hope for people who would try to do a recursive decent parser with it. You could do it, but it'd be dumb.
4.a. DOS is just powerful enough on the other hand. You can do most of the heavy lifting with it. Things like moving files around or even simple scheduling are easy. With so little possibilites, it is not at all hard to learn. Also, though Microsoft would like to see DOS die, it hasn't, so it's a convenient way to set up programs for Winblows machines. It's just that if you want to do real programming, you should do that. DOS is for the simple stuff.
5. Some simple things you can do without installing another command interpreter (IE perl, winscripting, vb, whatever); This means you can set them up in a flash on a new machine. I like having little batch files to KILL windows and shutdown when other things fail. Many people like to have a simple button to click that will back up all files modified after such-and-such a date, or to destroy all the cookies in your browser, or to merge logfiles, or whatever. If you've never given it a try, I reccomend it. I wish I'd learned DOS first (instead of basic). It's damn simple. Even better, it will screw you up bigtime when you go back to a *nix environment because everything is backwards in DOS.
No, there is no real point to this thread. But if you do have Batch tips, maybe this would be a good place to put 'em for others on Apolyton. When I did my search I found a lot of references to CivSwap, which got my heart beating fast because I've just written ModSwapper with batch. They are totally different. CivSwap is for in-game settings switchs based on Autosaves. ModSwapper is for installing and uninstalling and auto-install-launching mods for any game. Whew. But there are some people that still use DOS. Now I see why.
-Smack
Just a batch thread for discussing some things that might be good to know, especially before you take up Batch writing.
1. Dos memory is small. It can be inflated, but this is not usually recommended. Environment variables, IE, any variables you assign, seem to have the least space. I've had errors after just assigning 8 or 10 variables in a batch.
1.a. There are several ways to expand the memory. Actually dozens. MANY of them don't work on all versions of windows, which is why it's best to avoid these kind of solutions if you can. Some of these include 'Create a shortcut to the batch and then use the properties tabs to assign the memory spaces' : wrong, doesn't work in NT or XP. Or, 'change the shell environment' : wrong, you don't want to go messing with people's machine settings if you can help it. Besides which, these things are difficult to do and know where to do.
1.b. The one method that does seem to apply to all modern DOS, from what I can tell, is "command /C batchfile.bat /E:nnnnn" where n is a number between 160 and something bigger. Dos is typically run with only 256k available, so beefing that up to 1048 or higher is accpetable. the /C is to make it work like a 'call', and return to the line in the existing batch when the called batch is finished. The caveat here is that, though this works, it didn't help me with gaining more environment-variable space anyways. I had to use fewer variables. But it might help you.
2. Dos versions vary across all the windows environements. There are commands available to XP and NT users that will not work on earlier versions without installing extra files into your core directories.
3. Desipite #2, most of the best commands are available to machines with any version of Windows. Just avoid things like 'Choice' and some of the low level stuff such as modifying Command.com or things like that.
4. DOS is not Perl. There are only 10 native batch commands. 10! . Then there are another handful of DOS commands. Don't go writing real scripting with DOS. There's no hope for people who would try to do a recursive decent parser with it. You could do it, but it'd be dumb.
4.a. DOS is just powerful enough on the other hand. You can do most of the heavy lifting with it. Things like moving files around or even simple scheduling are easy. With so little possibilites, it is not at all hard to learn. Also, though Microsoft would like to see DOS die, it hasn't, so it's a convenient way to set up programs for Winblows machines. It's just that if you want to do real programming, you should do that. DOS is for the simple stuff.
5. Some simple things you can do without installing another command interpreter (IE perl, winscripting, vb, whatever); This means you can set them up in a flash on a new machine. I like having little batch files to KILL windows and shutdown when other things fail. Many people like to have a simple button to click that will back up all files modified after such-and-such a date, or to destroy all the cookies in your browser, or to merge logfiles, or whatever. If you've never given it a try, I reccomend it. I wish I'd learned DOS first (instead of basic). It's damn simple. Even better, it will screw you up bigtime when you go back to a *nix environment because everything is backwards in DOS.
No, there is no real point to this thread. But if you do have Batch tips, maybe this would be a good place to put 'em for others on Apolyton. When I did my search I found a lot of references to CivSwap, which got my heart beating fast because I've just written ModSwapper with batch. They are totally different. CivSwap is for in-game settings switchs based on Autosaves. ModSwapper is for installing and uninstalling and auto-install-launching mods for any game. Whew. But there are some people that still use DOS. Now I see why.
-Smack
Comment