Questions tagged [cmd]

Command Prompt (executable name cmd.exe) is the Microsoft supplied command line interpreter on OS/2, Windows CE, and all Microsoft Windows operating systems. Use this tag for questions regarding programming scripts or on commands available to run from the Command Prompt. Add tags for which version of Windows, and tags describing the task or issue.

Command Prompt (executable name cmd.exe) is the Microsoft-supplied command-line interpreter on Windows NT-based operating systems (including Windows 2000, XP, Vista, 7, 8, 10, Server 2003, Server 2008, Server 2012 and Server 2016), OS/2 and Windows CE. It is the analog of COMMAND.COM in MS-DOS and Windows 9x (where it is called MS-DOS Prompt) systems, or of the Unix shells used on Unix-like systems.

Include additional tags to identify the version of Windows such as , , , etc.

Resources:

See also:

26386 questions
152
votes
15 answers

How to detect if CMD is running as Administrator/has elevated privileges?

From inside a batch file, I would like to test whether I'm running with Administrator/elevated privileges. The username doesn't change when "Run as Administrator" is selected, so that doesn't work. If there were a universally available command,…
Jeff
  • 2,023
  • 2
  • 14
  • 10
152
votes
12 answers

How To Launch Git Bash from Windows Command Line?

I've got what I'm hoping is a simple question, but I haven't been able to find the answer yet. I would like to launch Git Bash from a Windows batch file. Here is what I tried so far: Launched Git Bash from Win 7 Start button Used CTRL+ALT+DEL to…
150
votes
6 answers

Open a Web Page in a Windows Batch FIle

I have a batch file that does a bunch of things and at the end needs to open up a web browser to a page. Is there a way to, in essence, call ShellExecute on a http to open the web page? Windows Command Prompt
Ian Vink
  • 66,960
  • 104
  • 341
  • 555
149
votes
6 answers

Escape double quotes in parameter

In Unix I could run myscript '"test"' and I would get "test". In Windows cmd I get 'test'. How can I pass double-quotes as a parameter? I would like to know how to do this manually from a cmd window so I don't have to write a program to test my…
700 Software
  • 85,281
  • 83
  • 234
  • 341
149
votes
12 answers

How to disable Hyper-V in command line?

I'm trying to open VMware, it says that VMware player and Hyper-V are not compatible. I found it here, but it's not working using the command it offers. I tried to see the help, found that there's /hypervisorsettings option there. But still not work…
Sky
  • 7,343
  • 8
  • 31
  • 42
148
votes
3 answers

How to run an application as "run as administrator" from the command prompt?

I have a batch file called test.bat. I am calling the below instructions in the test.bat file: start /min powershell.exe %sysdrive%\testScripts\testscript1.ps1 When I run this through the command prompt, my testscript is running successfully. I…
Praveen Jakkaraju
  • 1,601
  • 4
  • 16
  • 13
147
votes
31 answers

How to open an elevated cmd using command line for Windows?

How do I open a elevated command prompt using command lines on a normal cmd? For example, I use runas /username:admin cmd but the cmd that was opened does not seem to be elevated! Any solutions?
user2633882
  • 1,551
  • 3
  • 11
  • 6
147
votes
15 answers

'python' is not recognized as an internal or external command

So I have recently installed Python Version 2.7.5 and I have made a little loop thing with it but the problem is, when I go to cmd and type python testloop.py I get the error: 'python' is not recognized as an internal or external command I have…
Dave Stallberg
  • 1,503
  • 2
  • 13
  • 13
146
votes
10 answers

Redirecting Output from within Batch file

I am creating a batch file with some simple commands to gather information from a system. The batch file contains commands to get the time, IP information, users, etc. I assembled all the commands in a batch file, and it runs, but I would like the…
user3085030
  • 1,471
  • 2
  • 10
  • 3
145
votes
3 answers

Windows batch: call more than one command in a FOR loop?

Is it possible in Windows batch file to call more than one command in a single FOR loop? Let's say for example I want to print the file name and after delete it: @ECHO OFF FOR /r %%X IN (*.txt) DO (ECHO %%X DEL %%X) REM the line above is invalid…
Marco Demaio
  • 33,578
  • 33
  • 128
  • 159
143
votes
5 answers

How to split large text file in windows?

I have a log file with size of 2.5 GB. Is there any way to split this file into smaller files using windows command prompt?
Albin
  • 1,929
  • 2
  • 14
  • 18
141
votes
8 answers

Executing multiple commands from a Windows cmd script

I'm trying to write a Windows cmd script to perform several tasks in series. However, it always stops after the first command in the script. The command it stops after is a maven build (not sure if that's relevant). How do I make it carry on and run…
Darren Greaves
  • 3,326
  • 4
  • 29
  • 32
138
votes
10 answers

Set a path variable with spaces in the path in a Windows .cmd file or batch file

I'm new to script writing and can't get this one to work. I could if I moved the files to a path without a space in it, but I'd like it to work with the space if it could. I want to extract a bunch of Office updates to a folder with a .cmd file. …
marcerickson
  • 1,481
  • 2
  • 10
  • 4
137
votes
9 answers

Free space in a CMD shell

Is there a way to get the amount of free diskspace of a disk or a folder in a CMD without having to install some thirdparty applications? I have a CMD that copies a big file to a given directory and could of course use the errorlevel return from the…
Peter Lundkvist
134
votes
4 answers

How to run multiple DOS commands in parallel?

How to run multiple dos commands? I have a for loop, which runs detection of server to detect which server works and is fast. And because there is more servers, I wish not to run all server detections in sequence, but in parallel.
John Boe
  • 3,501
  • 10
  • 37
  • 71