Solved

run multiple cmd.exe commands in one go

Posted on 2013-11-18
2
246 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 35

Assisted Solution

by:Mahesh
Mahesh earned 250 total points
Comment Utility
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 13

Accepted Solution

by:
frankhelk earned 250 total points
Comment Utility
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Know what services you can and cannot, should and should not combine on your server.
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.
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

762 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now