New Developer
New Developer

Reputation: 3305

How to open command prompt from 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???

Upvotes: 13

Views: 62661

Answers (2)

Maksym Bondarenko
Maksym Bondarenko

Reputation: 404

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

Upvotes: 17

jpmc26
jpmc26

Reputation: 29974

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.

Upvotes: 4

Related Questions