Solved

run multiple cmd.exe commands in one go

Posted on 2013-11-18
2
252 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 36

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

Flexible connectivity for any environment

The KE6900 series can extend and deploy computers with high definition displays across multiple stations in a variety of applications that suit any environment. Expand computer use to stations across multiple rooms with dynamic access.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Computer account cleanup 90 128
sql server service accounts 4 42
Does Robocopy do a Delta copy of a file (Remote copy) ? 2 40
Disk Cleanup and Temporary Files 15 56
Issue: One Windows 2008 R2 64bit server on the network unable to connect to a buffalo Device (Linkstation) with firmware version 1.56. There are a total of four servers on the network this being one of them. Troubleshooting Steps: Connect via h…
Learn how to PXE Boot both BIOS & UEFI machines with DHCP Policies and Custom Vendor Classes
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…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

828 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