run powershell command from cmd
powershell -command "get-process | ? {$_.Description -eq 'Sysinter Process Explorer'} | select processname | out-file $env:APPDATA\example.txt"
basically you have a powershell command and paste it in between these quotes to call it from CMD
powershell -command " #PasteCodeHere "
inside these quotes you have to work with '
otherwise it will interrupt your command parameter.
Edit: Additional Information:
quite often you will encounter this: powershell -command "& 'somestuff'"
the &
is used to call a File. when you're only using a command &
is unnessecary, when you want to call a script, you should use it.
powershell -command "& 'C:\foobar.ps1'"
You could also use powershell -file C:\file.ps1
to call a script