Home » Questions » Computers [ Ask a new question ]

What is the difference between running a .bat from cmd line vs. double click?

What is the difference between running a .bat from cmd line vs. double click?

I have a .bat script with ftp commands (all in one) similar to this. See 5th down:FTP - Resolving Environment Variables - Creating FTP script on the fly at runtime and using variables within the FTP script

Asked by: Guest | Views: 336
Total answers/comments: 2
Guest [Entry]

"ANSWER:
My variables were declared before the for loop that saves the ftp commands in a temp file, and then replaces the variables with the values. So at that point, there were no variables to replace the ones used in the ftp script.

It only appeared it was working from the command line because once I called it the first time it probably errored there, but if I called it again without closing the console, the variables were now stored in memory. From there it then looked like it was always working from the console.

Once they were stored in memory it didn't matter that the for loop was before the variables. The variables were now stored in memory after opening it the first time.

When double clicking, it was opening for the first session, every time, and the variables were deleted in memory after it closed automatically. So in this case it opened and closed, each time I double clicked it.

Opening for the first session vs. calling it again in the same console without closing it out was the main difference here. Calling it the first time, the variables would be saved BEFORE after the ftp script was already created.

Please feel free to edit this if you can make it clearer..."
Guest [Entry]

"ANSWER:
My variables were declared before the for loop that saves the ftp commands in a temp file, and then replaces the variables with the values. So at that point, there were no variables to replace the ones used in the ftp script.

It only appeared it was working from the command line because once I called it the first time it probably errored there, but if I called it again without closing the console, the variables were now stored in memory. From there it then looked like it was always working from the console.

Once they were stored in memory it didn't matter that the for loop was before the variables. The variables were now stored in memory after opening it the first time.

When double clicking, it was opening for the first session, every time, and the variables were deleted in memory after it closed automatically. So in this case it opened and closed, each time I double clicked it.

Opening for the first session vs. calling it again in the same console without closing it out was the main difference here. Calling it the first time, the variables would be saved BEFORE after the ftp script was already created.

Please feel free to edit this if you can make it clearer..."