run bat files in multiple command windows (dos shells) - batch-file

I am new to working with bat files.
I have a program that basically does the following:
Write multiple bat files in different sub-folders inside a single main folder at once
The program itself utilizes a command :
"start bat_file_name"
( where bat_file_name is derived from the code say bat1,bat2,bat3)
With this the bat files are executed sequentially one after another in single shell. Is there any modification to the above command with which I can run those bat files in different shells or basically run the files in parallel in separate shells?
Any ideas would be helpful.Thanks.

The start command should already do what you need. I've just tried it here and several start commands in a batch file ran in parallel.

Related

Run multiple lines from .bat file

I'm trying to get a bat file together and not sure how to run multiple cmd lines through the .bat.
Objective: I want to be able to click on this .bat file to open cmd prompt, then to find a "folder" in the directory, rename the "Folder" then move the location of the folder then find a existing Folder and put it in the same directory.
Problem: i know how to run these cmds in the prompt without an issues.
So far this is what i have:
#echo off
start cmd.exe /k cd %AppData%\Microsoft\Network\Connections
#echo off
and then just write your commands its that simple
A .bat file is executed in a terminal window automatically, you don't need to call cmd.exe or anything like that.
Every single line you write in the .bat file is going to be executed one by one, so you just need to write multiple lines with all the instructions and then you can double click on your new file to run the script.
If you are not familiar with Windows commands for the terminal, you can find more info on the web about how to find a folder, rename it, etc. There are many things you can do by command line and this is not the right place to explain how to use them.

How write a correctly-working .bat file?

I have three commands that should be executed in a batch file. When I execute them manually, I don't have any problems, but in a .bat file, they don't work anymore...
First, a python virtual environment should start. Second, a python script should be executed. And last but not least: an mbedded webbrowser should be started.
The commands below work well while manually-executed, but not in the batch fil I created.
I have to following code in my batch file:
#echo off
dikopy\scripts\activate
python system\www\index.py
system\phpdesktop-chrome
What is wrong here? How can I make it work?

What is different between *.bat and *.sh and *.exe file?

When I start Apache Tomcat
start
tomcat/bin/startup.bat
tomcat/bin/startup.sh
stop
tomcat/bin/shutdown.bat
tomcat/bin/shutdown.sh
1. What is different between *.sh and *.bat and *.exe file?
So I know file follow that is like a program.
- *bat, *cmd - Batch, Comand
- *exe - C
- *jar - Java
I can read, understand script content in the *bat file.
2. Why don't use *exe instead *sh, *bat file to run ?
3. How the structure is in *bat, *sh, *exe file ?
A .bat file is a windows batch file it contains a sequence of windows/dos commands. These cannot be used in a Unix shell prompt.
A .sh file is a unix shell script it contains a series of unix commands. These cannot be ran in a Windows DOS or Powershell prompt.
An .exe is windows-only executable format, which may in-turn execute a .bat script or other compiled code. Also cannot be directly used in a Unix prompt.
Each can easily launch a series of commands, or a single command that requires complex environment variables or arguments. You can open a .bat file or the .sh file in a text editor like notepad and view the commands they're running.

Bat file service runs many times

I have created a bat file to start a Ruby service
working code is:
ruby C:\folder\Projects\folder\folder\script\server
It works fine when I open a command prompt ,paste it and run.
but not working when I created a bat file of it.
bat content is
ruby C:\folder\Projects\folder\folder\script\server
pause
when I run that bat file, it not working as expected. It runs multiple as shown below.
Please help me to resolve it.
The Batch file must have a name different than the process you want to run in it. In this case, the Batch file must not be named ruby.bat, because in this case, the line:
ruby C:\folder\Projects\folder\folder\script\server
placed in the Batch file imply a recursive invocation of itself...

How to run several batch files without open shell windows?

I've got some .bat files with start xxx and I need to run them all in another file
so if do start xxx.bat there I will get running xxx and command line shell. I don't need another shell so how to run batch file without opening another shell? or close it's shell after executing.
If I understand correctly, you just want to use call instead of start.
Example:
call xxx.bat

Resources