|If I use the same code in a Batch file it hangs up on the very first command and then gives me a File not Found error.|
What's giving the error? Filever or CMD? Are you running the commands in the same environment as the script? If I Filever's not in Win7, it might not be in the other workstation versions of Windows. If not, you might try a different language. (VBScript.)
Ok, if I copy the command string from my batch.bat file and remove the extra % signs and past it into a <Start Menu> <Run> <CMD> (MS-DOS Command Prompt) and hit "enter" the FOR command executes with no errors and sets my variable that I can then call by simply typing %_ver1% or %_ver2%. Regardless of which FOR I use, the variable is set and can be called in the CMD prompt.
If I run these same commands in the Batch.bat file, it pauses for about 60-120 seconds and then all of a sudden I get "File not found" scrolling across my screen over and over. However in explorer I can see that the file has been renamed to "Start Stop Dryer .exe". There is simply a space before the .exe.
If I click inside the CMD window and stop the scroll the batch file actually continues, but of course starts to error out because the file has already been renamed. Even if I insert a PAUSE after the first FOR command, it renames the file, which should be impossible because it hasn't even gotten to the REN command in my script.
The first command of the Batch file isn't even calling to rename the file (yet), but it keeps getting re-named.????
If neither IF test passes, execution falls though into your :UPDATE code. Remember, labels do not denote functions, and they do not stop execution. They're just targets of GOTO and CALL.
Like I said, I can insert a PAUSE in the sccript right after the first FOR command and my file is still being renamed without a REN command being called yet.
Note that CMD will compare file versions as text, so "1.9.0" will be greater than "1.11.0".
I was not aware of this, so far using several versions of this particular executable I have not had this problem. It has handled the comparison correctly. If this might be a problem in the future, then this code may not work.
As for using VBS scripts... the s/w developer I am working with would rather use a simple batch file to acheive this. He's writing the programs in LabView and could easily incorprate a VBS script but doesn't want to. Why not? He hasn't given me a good answer yet either. :-)
Thanks so much for your help Razor. I hope this helps to clarify... I really really appreciate your advice, I've been stuck on this stupid script for a few days now. It's really frustrating that I can manually use a CMD prompt and execute all of these commands, but not in a Batch file. I'm definitely missing something.