![]() |
![]() |
![]() |
|||||
![]() |
![]() |
![]() |
![]() |
![]() |
|||
| Welcome
to Tech Support Forum home to more then 136,000 problems solved. Issues
have included: Spyware, Malware, Virus Issues, Windows, Microsoft,
Linux, Networking, Security, Hardware, and Gaming Getting your
problem solved is as easy as: 1. Registering for a free account 2. Asking your question 3. Receiving an answer Registered members: * See fewer ads. * And much more..
|
| Want to know how to post a question? click here | Having problems with spyware and pop-ups? First Steps |
|
|||||||
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 (permalink) |
|
Registered User
|
[SOLVED] Batch file: multiple instances of a CMD command.
Hi all,
I would like to simultaneously launch multiple instances of a single CMD command. How do I write a batch file to do so? Regards, Nicholas. |
|
|
|
| Important Information |
|
Join the #1 Tech Support Forum Today - It's Totally Free!
TechSupportForum.com is a leading support website for your computer needs. We offer free, friendly and personalized computer support. Why pay to have your computer fixed when you can do it for free. Join TechSupportforum.com Today - Click Here |
|
|
#2 (permalink) | |
|
Moderator, Microsoft Supp
Join Date: Sep 2007
Location: The Great State of New Jersey - away from the gross corruption of the Riverside County, CA, SO office. SHAMEFUL !
Posts: 10,125
OS: Windows 7, Vista Ultimate
|
Re: Batch file: multiple instances of a CMD command.
Quote:
Hi Nicholas - For info, you can type cmd /? for details on the switches available with cmd. To answer your question, try cmd /k - that will execute the command and then keep running. Regards. . . jcgriff2 . |
|
|
|
|
|
|
#3 (permalink) |
|
Registered User
|
Re: Batch file: multiple instances of a CMD command.
I don't think you get the idea. For example, I can launch an instance of command prompt and type
ping www.website.com -t It will continue the process until I press control C. However I want now to launch for example, three separate instances of command prompt. How do I do this using a batch file rather than manually starting command prompt and entering the command? Regards, Nicholas. |
|
|
|
|
|
#4 (permalink) |
|
Moderator, Microsoft Supp
Join Date: Sep 2007
Location: The Great State of New Jersey - away from the gross corruption of the Riverside County, CA, SO office. SHAMEFUL !
Posts: 10,125
OS: Windows 7, Vista Ultimate
|
Re: Batch file: multiple instances of a CMD command.
Enter the commands into a notepad then save it as a BAT file.
|
|
|
|
|
|
#6 (permalink) |
|
Moderator, Microsoft Supp
Join Date: Sep 2007
Location: The Great State of New Jersey - away from the gross corruption of the Riverside County, CA, SO office. SHAMEFUL !
Posts: 10,125
OS: Windows 7, Vista Ultimate
|
Re: Batch file: multiple instances of a CMD command.
try this - copy to bat file an execute it
Code:
start cmd /k ping www.website.com -t & start ping www.website.com -t & start ping www.website.com -t jcgriff2 . Last edited by jcgriff2; 09-29-2009 at 05:53 AM. |
|
|
|
|
|
#7 (permalink) |
|
Registered User
|
Re: Batch file: multiple instances of a CMD command.
Hmm, running that batch file caused an infinite loop of command prompt windows. Which eventually forced me to reset the computer. Currently, the lines:
start cmd -ping www.website.com start cmd -ping www.website.com start cmd -ping www.website.com pause Successfully call out 3 windows, but they do not automatically run the ping command. Regards, Nicholas. Edit: the command prompt points to the Desktop instead of it's default (users\username). As a result I am unable to use any system commands. Last edited by billybong001; 09-29-2009 at 06:41 AM. |
|
|
|
|
|
#8 (permalink) |
|
Moderator, Microsoft Supp
Join Date: Sep 2007
Location: The Great State of New Jersey - away from the gross corruption of the Riverside County, CA, SO office. SHAMEFUL !
Posts: 10,125
OS: Windows 7, Vista Ultimate
|
Re: Batch file: multiple instances of a CMD command.
Hi -
I used the command that you provided... I didn't think anything of it. Where did you get it from? I have changed the command to timeout at 5 seconds - after launching the 3 separate windows. Place these into a Notepad, name w/ BAT file ext and execute it - Code:
start cmd /k PING 1.1.1.1 -n 1 -w 5000 >NUL start cmd /k PING 1.1.1.1 -n 1 -w 5000 >NUL start cmd /k PING 1.1.1.1 -n 1 -w 5000 >NUL A screenshot of my system is attached. 4 cmd/DOS screens total. Regards. . . jcgriff2 . |
|
|
|
|
|
#9 (permalink) |
|
Registered User
|
Re: Batch file: multiple instances of a CMD command.
Thank you jcgriff2, that was absolutely perfect.
I typed out what I would typically enter into command prompt after Users\nicky9499> It seems I was missing out the /k tags to make it execute. Speaking of which, what does the /k and >NUL do? Regards, Nicholas. Last edited by billybong001; 09-30-2009 at 05:54 AM. |
|
|
|
|
|
#10 (permalink) | |
|
Moderator, Microsoft Supp
Join Date: Sep 2007
Location: The Great State of New Jersey - away from the gross corruption of the Riverside County, CA, SO office. SHAMEFUL !
Posts: 10,125
OS: Windows 7, Vista Ultimate
|
Re: Batch file: multiple instances of a CMD command.
Quote:
Hi Nicholas. . . I am glad that the "final version" is what you were looking for! The parm /k tells the cmd/DOS windows from which the command was executed to stay open >NUL directs the output to go nowhere sort of like ECHO OFF You can get a full listing of these parms. Copy/paste the following - Code:
cmd /? > %temp%\1 & start notepad %temp%\1 Regards. . . jcgriff2 . |
|
|
|
|
![]() |
| Thread Tools | |
|
|