Solved

run multiple cmd.exe commands in one go

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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Can't log in to windows 7 11 59
winrar and 7zip compression not ok 3 35
Location of files for Quick Access Toolbar (QAT) settings in Office 2010 3 35
Problem to App source 6 40
NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup" or a blinking cursor with black screen. A loop for Auto repair will start but fix nothing.  You will be panic as there are no back…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…

772 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