• What OS are you using? Are you looking at plain text files, *.txt?
  • Wow, I used to know how to do that, I haven't written a command line batch file in about 4 years, and haven't been regular in 10. Well, there is an "if exist than" syntax, I can't quite remember. Maybe included the word "else" in there somewhere as well. I used to have an excellent online dos syntax book handy. Best way to figure it out would be to get your hands on an hold MS-Dos manual (3.3 or 4.01 would be best bets for a physical book) If you search for doshelp.exe, that's basically the book in online form. It was included with dos 6 through windows 98 (on the install CD in a folder called DOSSTUFF I think)
  • It's easier to use the "Answer" window to pass info to you. If I need to add something or correct an error, it lets me go in later and Edit. Tip: [In the CMD window] When you're learning a new command, like FIND, type find /? To save the output, redirect it into a text file. Example: find /? > find.txt This redirects the output into a new file named find.txt in the current directory of the current partition. You can switch back to Windows, leaving the CMD window open, and double-click on find.txt to open it with Notepad. Then you can edit and print it. If find.txt already exists, the above command will overwrite it. If you want to keep it and add to it, do this: find /? >> find.txt The double >> APPENDS the output of "find /?" to find.txt.
  • You might use the output of the FIND command to set an environment variable, then check that env. var. inside a bat file using IF, as in my previous comment, above. BTW, for learning purposes, you can manually check any env. var. in your DOS environment. Examples: set [lists all current env. var's] set windir [displays path of your Windows directory] set flag [displays flag variable, which doesn't exist yet] set flag=banana [sets flag to value] set flag [displays flag = banana] echo I like %flag%s [I like bananas] set flag= [clears flat] BTW, all env. var's get cleared from memory on power-down. They get recreated from ini files on next boot or from a bat file. Don't change any system env. var's (the big list you see when you type "set" ). If you do, reboot before you make a mess. :( This doesn't solve your entire problem, but maybe it'll give you some ideas.
  • Don't believe Mr_Natural. Of course you can call a label in a bat file. I do that all the time, but, hey, don't take my word for it: Maybe you now wonder about the difference between CALL and GOTO. The difference is that if you GOTO a label, then you just go there without returning. If you CALL a label on the other hand, then you will return from the labeled section. Thus, CALL treats the labeled section as a sub-routine (or function or method, if you come from those languages). You mark the end of the sub-routine with a "GOTO :eof".

Copyright 2016, Wired Ivy, LLC

Answerbag | Terms of Service | Privacy Policy