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
131
votes
10 answers

Windows XP or later Windows: How can I run a batch file in the background with no window displayed?

I know I have already answered a similar question (Running Batch File in background when windows boots up), but this time I need to launch a batch: from another batch, without any console window displayed, with all arguments passed to the invisible…
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
130
votes
19 answers

How to create ls in windows command prompt?

I want to use ls in windows command prompt and make it run the dir command. How can I do that?
aF.
  • 64,980
  • 43
  • 135
  • 198
129
votes
15 answers

VMware Workstation and Device/Credential Guard are not compatible

I have been running VMware for the last year no problems, today I opened it up to start one of my VM and get an error message, see screen shot. I did follow the link and went through the steps, on step 4 I need to mount a volume using "mountvol".…
Gman
  • 2,433
  • 3
  • 26
  • 36
128
votes
2 answers

windows batch SET inside IF not working

when I'm running this script (from a .bat file): set var1=true if "%var1%"=="true" ( set var2=myvalue echo %var2% ) I always get: ECHO is on. Meaning the var2 variable was not really set. Can anyone please help me understand why?
Orad SA
  • 1,885
  • 5
  • 16
  • 16
128
votes
7 answers

How to update PATH variable permanently from Windows command line?

If I execute set PATH=%PATH%;C:\\Something\\bin from the command line (cmd.exe) and then execute echo %PATH% I see this string added to the PATH. If I close and open the command line, that new string is not in PATH. How can I update PATH permanently…
vale4674
  • 4,161
  • 13
  • 47
  • 72
128
votes
8 answers

How to check command line parameter in ".bat" file?

My OS is Windows Vista. I need to have a ".bat" file where I need to check if user enters any command-line parameter or not. If does then if the parameter equals to -b then I will do something otherwise I will flag "Invalid input". If user does…
javauser71
  • 4,979
  • 10
  • 27
  • 29
127
votes
11 answers

Create a new cmd.exe window from within another cmd.exe prompt

I am in the process of setting up CruiseControl.NET. The problem I am having is that I am running CC as a console application and when my build completes successfully and executes (using exec) it launches it within the CruiseControl DOS prompt. I am…
Mark Stahler
  • 4,186
  • 6
  • 29
  • 29
127
votes
9 answers

How do I execute cmd commands through a batch file?

I want to write a batch file that will do following things in given order: Open cmd Run cmd command cd c:\Program files\IIS Express Run cmd command iisexpress /path:"C:\FormsAdmin.Site" /port:8088 /clr:v2.0 Open Internet Explorer 8 with URL=…
patel
  • 1,533
  • 4
  • 14
  • 15
126
votes
19 answers

IF... OR IF... in a windows batch file

Is there a way to write an IF OR IF conditional statement in a windows batch-file? For example: IF [%var%] == [1] OR IF [%var%] == [2] ECHO TRUE
Anthony Miller
  • 15,101
  • 28
  • 69
  • 98
126
votes
15 answers

How to copy a directory structure but only include certain files (using windows batch files)

As the title says, how can I recursively copy a directory structure but only include some files. E.g given the following directory structure: folder1 folder2 folder3 data.zip info.txt abc.xyz folder4 folder5 …
M4N
  • 94,805
  • 45
  • 217
  • 260
126
votes
13 answers

How can I make an "are you sure" prompt in a Windows batch file?

I have a batch file that automates copying a bunch of files from one place to the other and back for me. Only thing is as much as it helps me I keep accidentally selecting that command off my command buffer and mass overwriting uncommitted…
Josh Ribakoff
  • 2,948
  • 3
  • 27
  • 26
125
votes
5 answers

Delete a directory and its files using command line but don't throw error if it doesn't exist

I need a Windows command to delete a directory and all its containing files but I do not want to see any errors if the directory does not exist.
jaywayco
  • 5,846
  • 6
  • 25
  • 40
124
votes
8 answers

How do I run a batch script from within a batch script?

How do I call another batch script from within a batch script? I want it to execute in an if statement.
Kev
  • 1,251
  • 2
  • 8
  • 4
122
votes
12 answers

How to automatically close cmd window after batch file execution?

I'm running a batch file that has these two lines: start C:\Users\Yiwei\Downloads\putty.exe -load "MathCS-labMachine1" "C:\Program Files (x86)\Xming\Xming.exe" :0 -clipboard -multiwindow This batch file is used to run the Xming application and…
yiwei
  • 4,022
  • 9
  • 36
  • 54
121
votes
5 answers

Running CMD command in PowerShell

I am having a bunch of issues with getting a PowerShell command to run. All it is doing is running a command that would be run in a CMD prompt window. Here is the command: "C:\Program Files (x86)\Microsoft Configuration…
user3585839
  • 1,459
  • 3
  • 12
  • 18