9 ms·
"Typing cmd in the run dialog will launch PowerShell as well" What? I'm a big PowerShell fan, but I see the need to keep cmd around for a while. Clobbering it
by FLGMwt 10y ago
"Typing cmd in the run dialog will launch PowerShell as well"
What? I'm a big PowerShell fan, but I see the need to keep cmd around for a while. Clobbering it before it's phased out seems problematic.
- freedrock87 10y agoYou can run any command from CMD in Powershell
- viraptor 10y agoBut are all cmd commands portable verbatim to powershell? With all the options / special characters? (I don't know the answer, but https://en.wikipedia.org/wiki/PowerShell#Comparison_of_cmdlets_with_similar_commands https://en.wikipedia.org/wiki/PowerShell#Comparison_of_cmdle... lists quite a few missing commands, including "talkkill" and "find") With the amount of online posts that tell you "to achieve X, open command prompt and run ...", it would be a bad idea to break any of them that go beyond a simple command. (so for example any "FOR ..." lines)
- janwillemb 10y agoTalkkill seems like a very useful feature to me ;)
- orbitingpluto 10y agoThere can be several aliases for a single command. ls=dir=gci="Get-ChildItem" But you can't run just run "dir /s". You'd have to say "Get-ChildItem -Recurse" which can be shortened to "dir -Recurse" which can be shortened to "dir -r". When scripting, you try to use the longform versions. With one-liners, you just sort of fall into whatever paradigm you were previously accustomed to for your first argument.
- hobarrera 10y agoSuch basic commands are actually CamelCase? It must be a pain for those with no short-aliases.
- sveiss 10y agoYou can, but sometimes the quoting rules differ. For example, bcdedit with its {}-delimited GUIDs breaks in PowerShell without additional quoting, but works fine in cmd.exe. Makes following online instructions tricky if you're not familiar with that nuance.
- ygra 10y agoWell, the nice thing in PowerShell is that you have explicit control over "stop parsing here and just pass the rest to the application verbatim" with --%. Solves a lot of quoting nightmares.
- LeonidasXIV 10y agoThat's indeed nice. I wonder if there is something like that for ZSH.
- dylanfw 10y agoI don't know for sure about ZSH and can't test it at the moment, but Bash has -- for this purpose. It may work in ZSH as well.
- ygra 10y agoIsn't the -- a feature of the command to stop option parsing and treat the remaining arguments as file names? AFAIK it's not a shell feature that solves quoting (and it's not that easy on Unix either, since running a program involves argument parsing instead of just passing a string).
- Sean1708 10y agoYou could define `--` as "perform no expansions for the rest of the line", then you wouldn't have to worry about globs or `{}` which is where most of my annoyances come from. BTW `--` isn't treated specially in version 4 of Bash.
- 10y ago
- r00fus 10y agoDoes Powershell support all my old batch scripts?
- shocks 10y agoMicrosoft are taking Apple's approach!
- rnnr 10y agoAgreed. I like PS too but forcing it breaks a lot of staff, you cant use it interchangeably, eg 2 quickies: -bcdedit /c {xxxx-xxx-xxx-xxx} (= {..} is parsed as a code block) -invoking executables with spaces in path
- deviate_X 10y agoUpgrade your staffs ;)
- ygra 10y agobcdedit --% /c {xxxx-xxx-xxx-xxx} & 'C:\Program Files\Foo\Foo.exe'
- rnnr 10y agoI know, you could also just put {} around quotation marks and would work. My and parent's point was that it will probably flood MS's support channels, if you just force every cmd user into PS.
- jongalloway2 10y agoThe news article is incorrect. Typing cmd from the run dialog still launches cmd.exe. The release post spells out exactly what's changes - win-x menu, context menu kind of stuff.