Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to open command prompt from powershell

Tags:

powershell

I am new to powershell.
Can any body please explain me how to open command prompt from powershell.

I want to open command prompt and run Dir command

Is it possible to use new-object -comobject for this???

like image 584
New Developer Avatar asked Jul 19 '13 08:07

New Developer


People also ask

Can I Run cmd commands in PowerShell?

The executables can be run from any command-line shell, like PowerShell. This includes script files that may require other shells to work properly. For example, if you run a Windows batch script ( . cmd file) in PowerShell, PowerShell runs cmd.exe and passes in the batch file for execution.

How do I open the Command Prompt?

Click the Windows Start Button. In the search box type cmd. In the search results, Right-Click on cmd and select Run as administrator (Figure 2). This will open the Command Prompt window (Figure 3).

How do I get Command Prompt instead of PowerShell?

Press Ctrl + Shift + 2 while the Terminal window is in focus. This opens a new tab with the Command Prompt shell. You can now close the first tab and start working using CMD. To close the first tab, click on the X button next to the Windows PowerShell tab name.


2 Answers

Just run start cmd.
That will open Command Prompt in a new window.

like image 77
Maksym Bondarenko Avatar answered Sep 18 '22 06:09

Maksym Bondarenko


dir is built into PowerShell. It's an alias for Get-ChildItem. Open a PowerShell prompt from the Start Menu (All Programs --> Accessories if you're on XP, just search on higher versions of Windows), and just type dir and press Enter. It works similarly to the dir Command Prompt command.

A COM object is definitely overkill. If you really, really need to use the Command Prompt within PowerShell, just run cmd. That will launch an instance of the Command Prompt in the current window.

like image 41
jpmc26 Avatar answered Sep 19 '22 06:09

jpmc26