Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

run multiple cmd.exe commands in one go

Posted on 2013-11-18
2
Medium Priority
?
272 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 38

Assisted Solution

by:Mahesh
Mahesh earned 1000 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 1000 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Configuring Remote Assistance for use with SCCM
Windows Server 2003 introduced persistent Volume Shadow Copies and made 2003 a must-do upgrade.  Since then, it's been a must-implement feature for all servers doing any kind of file sharing.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

604 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