Is it possible to/how do you stop powershell using certain cmdlets?

JonnyRaa

Powershell is clearly a lot better than cmd but it hides basic functionality. I normally use it to figure out how to use commands that I want in scripts but it breaks a large number of basic things and I end up using both side by side if I hit a sticky spot.

Today this was removing a directory - rd or rmdir - both of which are broken in powershell in favour of one it's undocumented (from the commandline) cmdlets Remove-Item. I seem to run into it all the time though - sc (for mucking around with services); where for finding what program is being called when you type a command etc etc.

Hilariously I actually got the problem with sc and then googled to find out the command where only to discover that didnt work in powershell either! That was a confusing day

In some cases once you know this is what's going on you can type the full exe name (for instance 'where.exe' will work whereas 'where' on its own wont).

This isn't the case with rmdir however. Although interestingly typing 'where rmdir' in cmd doesnt work.

So... my question is this - Is there a way of turning off (preferably all) cmdlets in powershell and just getting the normal stuff instead?

Josh

There is no need to turn off cmdlets in powershell as that would destroy the very reason for having it.

Most of the "normal" stuff is there anyway, which you can find by using the get-alias command.

C:\> get-alias

CommandType     Name
-----------     ----
Alias           % -> ForEach-Object
Alias           ? -> Where-Object
Alias           ?? -> Invoke-NullCoalescing
Alias           ac -> Add-Content
Alias           asnp -> Add-PSSnapin
Alias           cat -> Get-Content
Alias           cd -> Set-Location
Alias           chdir -> Set-Location
.....
..... AND A WHOLE LOT MORE!

If you are missing a command that you really, really want to have, then you can easily add a new alias:

Set-Alias python2 "C:\Python27\python.exe"

In order to avoid having to do this every single time, you can simply add this into your startup profile. Just type in $PROFILE into the command prompt and it will show you the file path. If it doesn't exist, simply create it, and any powershell commands you add to the top will be automatically invoked when you start a new session.

And last thing. All of the commands are documented, and you can get to them easily using just two.

Just type this into your command prompt and you will be on your way to Powershell enlightenment!

get-help get-command

get-command -noun Item
get-command -verb get

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Is it possible to/how do you stop powershell using certain cmdlets?

From Dev

How to install Azure cmdlets using powershell

From Dev

How to install Azure cmdlets using powershell

From Dev

Do PowerShell cmdlets run on Linux dotnet? Or only Microsoft .NET?

From Dev

Is it possible to delete or overwrite cmdlets?

From Dev

Concatenating Multiple cmdlets in Powershell

From Java

Chocolatey not Working with PowerShell cmdlets

From Dev

Installing TFS PowerShell Cmdlets

From Dev

Interoping With PowerShell CmdLets

From Dev

Execute multiple cmdlets in PowerShell

From Dev

Combining Powershell cmdlets issue

From Dev

Is there a verbose mode for PowerShell cmdlets?

From Dev

Using Redux how do you stop the switch in the reducer growing?

From Dev

Calling powershell cmdlets in powershell script

From Dev

Is it possible to stop a certain thread from running?

From Dev

How do you keep track of changes in registry using powershell?

From Dev

Primalscript/Primalforms not recognizing powershell cmdlets

From Dev

How do I get PowerShell 4 cmdlets such as Test-NetConnection to work on Windows 7?

From Dev

PowerShell Editing Cmdlets/ Making new ones/ Merging Cmdlets

From Dev

How do you control callbacks and stop them from returning without using async?

From Dev

Using swift and spritekit, how do you stop the scene from unpausing after becoming active / moving to foreground?

From Dev

When using infile in SAS for a fixed-width file, how do you stop input when you encounter a blank line?

From Dev

how do you parse a sysmon file to extract certain information using R?

From Dev

How do you print out a palindrome with certain characters removed using arrays?

From Dev

Is it possible to stop certain fields in a document from being included in replication in CouchDB?

From Dev

Is it possible to stop a Simulink simulation when a certain condition is met?

From Dev

How do you stop a particle effect? (SKEmitterNode)

From Dev

How do you stop an Observable.Timer()?

From Dev

How do you stop a python SimpleHTTPServer in Terminal?

Related Related

  1. 1

    Is it possible to/how do you stop powershell using certain cmdlets?

  2. 2

    How to install Azure cmdlets using powershell

  3. 3

    How to install Azure cmdlets using powershell

  4. 4

    Do PowerShell cmdlets run on Linux dotnet? Or only Microsoft .NET?

  5. 5

    Is it possible to delete or overwrite cmdlets?

  6. 6

    Concatenating Multiple cmdlets in Powershell

  7. 7

    Chocolatey not Working with PowerShell cmdlets

  8. 8

    Installing TFS PowerShell Cmdlets

  9. 9

    Interoping With PowerShell CmdLets

  10. 10

    Execute multiple cmdlets in PowerShell

  11. 11

    Combining Powershell cmdlets issue

  12. 12

    Is there a verbose mode for PowerShell cmdlets?

  13. 13

    Using Redux how do you stop the switch in the reducer growing?

  14. 14

    Calling powershell cmdlets in powershell script

  15. 15

    Is it possible to stop a certain thread from running?

  16. 16

    How do you keep track of changes in registry using powershell?

  17. 17

    Primalscript/Primalforms not recognizing powershell cmdlets

  18. 18

    How do I get PowerShell 4 cmdlets such as Test-NetConnection to work on Windows 7?

  19. 19

    PowerShell Editing Cmdlets/ Making new ones/ Merging Cmdlets

  20. 20

    How do you control callbacks and stop them from returning without using async?

  21. 21

    Using swift and spritekit, how do you stop the scene from unpausing after becoming active / moving to foreground?

  22. 22

    When using infile in SAS for a fixed-width file, how do you stop input when you encounter a blank line?

  23. 23

    how do you parse a sysmon file to extract certain information using R?

  24. 24

    How do you print out a palindrome with certain characters removed using arrays?

  25. 25

    Is it possible to stop certain fields in a document from being included in replication in CouchDB?

  26. 26

    Is it possible to stop a Simulink simulation when a certain condition is met?

  27. 27

    How do you stop a particle effect? (SKEmitterNode)

  28. 28

    How do you stop an Observable.Timer()?

  29. 29

    How do you stop a python SimpleHTTPServer in Terminal?

HotTag

Archive