# Powershell 3.0 and running command prompt

by buuren at 2013-02-04 04:59:54

Hello.

I’ve decided to try powershell 3.0 and tested my old 1.0/2.0 scripts. So far, the majority of functions work well, however I’m having problems running basic cmd commands (such as ipconfig, net, ping etc) through powershell.

In powershell 2.0, I was able to run any command using
`cmd /c "cmd command goes here"`
For example
`cmd /c schtasks /create /tn …`
I’m not able to run those commands anymore, it says “The term ‘cmd’ is not recognized as the name of a cmdlet,function, etc…”. I’ve tried to run those commands using “invoke-expression”, but still with no success. Execution policy is unrestricted. Standard powershell cmdlets work fine. It’s just those old MS-DOS commands I’m having problems with.

I must be doing something wrong, but can’t figure out what’s that. Does anyone know how to bypass cmd commands in powershell 3.0?
by Klaas at 2013-02-04 05:06:26
Why do you use cmd? I’ve always typed just the command I need, in all versions of Powershell:
`ipconfigpingnetstat -antracertschtasks.exenslookup`
As mentioned above, most of what you are trying to do can run without issue in PowerShell, although you may need to be explicit if there is overlap (e.g. set is an alias, so you would need to use set.exe for that command).

On a side note, I can’t reproduce your issue. Works without issue for me:

`#28 8:32 C:\sc\prod> cmd.exe /c ipconfigWindows IP ConfigurationEthernet adapter Ethernet:`

You might want to check your path variable?
by buuren at 2013-02-05 23:59:55
[quote=“Klaas”]Why do you use cmd? I’ve always typed just the command I need, in all versions of Powershell:
`ipconfigpingnetstat -antracertschtasks.exenslookup`…[/quote]

Exactly. I used to type those commands without any cmd and it worked well. Now when I type any of those command, it throws an error that command is not recognized as a cmdlet, function etc.

Thanks cookie.monster. It looks like the problem was environment paths/aliases.

[quote]The command winrm was not found, but does exist in the current location. Windows PowerShell doesn’t load commands from the current location by default. If you trust this command, instead type “.\wirnm”.[/quote]

Probably the environment paths were not properly set up during installation. Running commands with ".&quot; prefix works fine. Case closed