PowerShell
PowerShell copied to clipboard
Feedback provider for legacy usage
Summary of the new feature / enhancement
Users switching from cmd or bash may have muscle memory for commonly used commands with parameters. It would be useful to have a FeedbackProvider detect this and inform the user what the correct PowerShell syntax would be and have a predictor so that it can fill in the suggested fix.
Common use cases:
rm -rf dir /s/q
Please add your own to this issue.
Proposed technical implementation details (optional)
No response
From cmd, I find myself doing
-
dir /s /b
-
rd /s /q
Yes, rd /s /q
is the primary reason I'm still using cmd instead of PowerShell
ipconfig arp netstat tracert ping route
dir /a:h to see hidden files cmd /c dir /a:h works of course, I just get an error first and remember to add that
nslookup
In recent history this has been provided for UNIX by "rosetta stones", eg https://www.lurklurk.org/rosetta.html or https://bhami.com/rosetta.html. This would be easier to manage as an external page rather than a feedback provider.
One might say that the origin of the problem in PowerShell is the concept of mapping aliases of commands with the same name to something that does something different.
Rosetta stones does not solve the frustration of broken muscle memory
ls -la Always gets me
ipconfig arp netstat tracert ping route
These commands all still work in PowerShell. There are equivalent commands for some things, but if you want Test-NetConnection instead of ping it is probably because you want different functionality
nslookup ping -t shutdown /r /t 0 echo wget curl set (to display environment variables, cmd) icacls (huge rabbit hole but would be nice if it had a translation table, from icacls to set-acl)
Mostly the same although there are some things in shutdown.exe
that stop-computer
/ restart-computer
doesn't same able to do. Set
is an obvious one which is missing. Things like curl
vs invoke-webrequest
if you know curl
and you don't need any other functionality then using what you would use in another shell is fine. .
Echo
is aliased so the muscle memory works
dir /a:h to see hidden files cmd /c dir /a:h works of course, I just get an error first and remember to add that
It took me ages to learn that dir -force in Powershell returned hidden and system files, but "filter to just hidden" is clunky.
One that gets me is in most languages we can create an object with Var = New Object-type, but in PS, New is the old -Object cmdlet that doesn't have an alias to the verb without the -Object
rm -rf
ls -la
df -h
So unix like tools would be a cool thing
Users switching from cmd or bash may have muscle memory for commonly used commands with parameters.
Is there a need on Linux or macOS? Most of the commands mentioned simply use the underlying implementation so should just work.
PS /home/bythesea> get-command mkdir,ls,pwd,cat,echo,rm,df,curl,wget,ping,traceroute
CommandType Name Version Source
----------- ---- ------- ------
Application mkdir 0.0.0.0 /bin/mkdir
Application ls 0.0.0.0 /bin/ls
Alias pwd -> Get-Location
Application cat 0.0.0.0 /bin/cat
Alias echo -> Write-Output
Application rm 0.0.0.0 /bin/rm
Application df 0.0.0.0 /bin/df
Application curl 0.0.0.0 /usr/bin/curl
Application wget 0.0.0.0 /usr/bin/wget
Application ping 0.0.0.0 /bin/ping
Application traceroute 0.0.0.0 /usr/sbin/traceroute
It appears you are trying to recursively and forcibly remove files. In PowerShell, the correct syntax would be:
rm -r -fo
But this isn't really true, because while it is an alias on Windows it uses the native command on Linux and macOS
On Linux
PS> get-command rm
CommandType Name Version Source
----------- ---- ------- ------
Application rm 0.0.0.0 /bin/rm
On Windows
PS> get-command rm
CommandType Name Version Source
----------- ---- ------- ------
Alias rm -> Remove-Item
So it would be more correct to say
It appears you are trying to recursively and forcibly remove files. In PowerShell, the correct syntax would be:
Remove-Item -Recurse -Force
If you want users to write portable scripts.
you like?
Set
is an obvious one which is missing. Things likecurl
vsinvoke-webrequest
if you knowcurl
and you don't need any other functionality then using what you would use in another shell is fine.
I am not sure why Set
should be considered missing. PowerShell is not cmd.exe
, it does not manage its variables in the same way, and neither should it pretend to. Set
is already included in Approved Verbs for PowerShell Commands so any other interpretation would be more confusing.
curl
is not an alias anymore so should happily work even on Windows.
PS> Get-Command curl
CommandType Name Version Source
----------- ---- ------- ------
Application curl.exe 8.0.1.0 C:\WINDOWS\system32\curl.exe
Linux
PS> Get-Command curl
CommandType Name Version Source
----------- ---- ------- ------
Application curl 0.0.0.0 /usr/bin/curl
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.
Still a good addition to PowerShell that I don't think has been added yet.
This issue has been marked as "No Activity" as there has been no activity for 6 months. It has been closed for housekeeping purposes.