| 1. |
Solve : Edit Autoexec.bat Through a .bat?? |
|
Answer» I feel totally retarded. I am running on the windows XP OS On XP machines, the autoexec.bat file has morphed into the autoexec.nt file. It is used (along with the config.nt file) to initialize the command prompt environment (cmd.exe) Windows initializes from values in the registry. Thank you so MUCH Guru Gary, that actually did help. Sorry about my response it was just late at night and I took reaper's response pretty harsh. But actually this is a bet from a friend. He made some program or whatever that basically just creates a blank file on startup. and he bet me $20 that I couldn't make a program to delete it on startup. It sounds nerdy, mainly because it IS but I learned about DOS and hopefully getting $20. Question 3 was just for my own info. It really was a interesting experience and I might find a use for bat files LATER on. But SERIOUSLY thank you seriously now...nobody answered..how to edit a another .bat file with a .bat file...a I would really like to know...Do you want to edit the entire thing or just add something at the end or completely change the file you are editing. There are two ways I know how to do this. Outline: delete the current file create a new file in the same location with an edited code Is that more or less what you (two) are looking for?Quote from: adikid on May 26, 2007, 04:24:02 AM seriously now...nobody answered..how to edit a another .bat file with a .bat file...a I would really like to know... Hints are appropriate for a true learner. You don't want to just see how the magic trick is done, do you?btw my COMMENT was possibly a bit misinterpreted... i do actually enjoy doing things like this and i would like to know about this particular subject aswell It is not easy to edit / replace strings in batch. You can use SET := to do string replacement, but there are several characters that will confuse that SET command. So basically there is no robust reliable way to edit a .BAT file with another .BAT file (without lots and lots of work and error checking). Here is a simple example: Code: [Select]@echo off set String=Hello World echo %String% set String=%String:World=Reaper% echo %String% So using that example, you could get each line out of a file (with a FOR /F loop) and replace the contents that you are looking for with new values using the SET := but you will need to do lots of error checking as there are lots of characters you will need to work around. Is that what you were looking for? |
|