Solved

run multiple cmd.exe commands in one go

Posted on 2013-11-18
2
253 Views
Last Modified: 2013-11-20
Is there any clever way to run a bulk of cmd.exe commands in one go, i.e NET commands (all of which output is written to >txtfile.txt). Rather than having to type each manually and hit enter. I thought if you have a heap of them you could go for it in one go to save time (especially if you dont have to see the output in the command prompt box itself).
0
Comment
Question by:pma111
2 Comments
 
LVL 37

Assisted Solution

by:Mahesh
Mahesh earned 250 total points
ID: 39656326
You can have all your commands in one batch file with >> (redirector switch)

example

Ipconfig /all > C:\testresults.txt
dnscmd /clearcache >> C:\testresults.txt
This will return all commad output to single notepad
don't know which net commads you are talking about please

Thanks
0
 
LVL 14

Accepted Solution

by:
frankhelk earned 250 total points
ID: 39656438
If you just need to concatenate 2 commands, there's a neat way to do so - just put an ampersand (&) in between.

I.e. to restart the a NTP client installed as service in Windows, just type

NET STOP NTP & NET START NTP

Works with several commands in line, limited only by the allowed length of the command line.

Refer to the help for cmd.exe for details.

(BTW: A batch file is more simple to use ...)
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you get continual lockouts after changing your Active Directory password, there are several possible reasons.  Two of the most common are using other devices to access your email and stored passwords in the credential manager of windows.
This article summaries thoughts and ideas from two years of sustained use. It provides good reasoning to make the jump to Windows 10.
This Micro Tutorial will give you a basic overview of Windows DVD Burner through its features and interface. This will be demonstrated using Windows 7 operating system.
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question