There are multiple possible approaches, including alternate solutions.
Will you have any other "command prompt" windows open that you care about? If not, open up a new command prompt and kill all the command prompt windows:
TASKKILL /fi "imagename eq cmd.exe"
Alternatively, why have 100 windows created? As Vinayak's comment noted, that may not be needed. Consider making one batch file that uses the CALL command multiple times. e.g.:
If you are trying to run all this simultaneously instead of sequentially, the start command may be useful. Consider:
Start CMD /C File1.bat
Start CMD /C File2.bat
* Perhaps especially if using the START command, you're best off if you are careful with PATHs. So, don't just run "File1.bat" if "File1.bat" is not in your PATH or your current directory. Whenever creating a new window, I am in the habit of not trusting that I start in the current directory I think I do. That may involve using the
CD command more often (perhaps even more often than necessary, just to be safe). Or, many commands can be run from other directories if you specify the full path. e.g.:
Start CMD /C %USERPROFILE%\mybats\File1.bat
Start CMD /C %USERPROFILE%\mybats\File2.bat
If you have a "space" character in your directory/folder names, you may need to surround the entire path with quotation marks.
Echo My home directory is %USERPROFILE%
Start "" CMD /C "%USERPROFILE%\mybats\File1.bat"
Start "" CMD /C "%USERPROFILE%\mybats\File2.bat"
- If you need to use quotation marks in your START command, be careful. The START command has surprised many people by treating the first set of quotation marks as characters that have a special meaning: setting a window title. That is why the above examples show a set of quotation marks before the paths.
- I am writing this answer based on memory/knowledge. I haven't tested this when writing this answer, primarily because I couldn't think of a very useful test that would apply well to your task, because I'm not fully understanding your task. However, 100 batch files, times two hours a piece, is 8 days 8 hours. So i highly recommend spending several minutes testing your approach (with some simple/test batch files) before launching your over-week-long event.
- Older versions of Windows have sometimes had some funny limits, perhaps especially when using features designed to provide some compatibility with the older MS-DOS code which was even more filled with funny limits. Microsoft has improved this situation by remedying many DOS-related quirks as time marched on. However, I'd question if 100 simultaneous windows might break something, in at least some versions of Windows. You are advised to be careful, and not rely on the results of untested procedures. (If you have no prior results, the proper procedure is to do a smaller task that is easy to test, and make sure you thoroughly test things before relying on the results.) I realize such ideas may seem obvious, and I realize that actually testing stuff may be harder in practice than theory, but I point this out because such procedures are often so important that they are worth mentioning anyway.