3 ms·
If you haven't tried PowerShell I strongly recommend you do. It is really well designed and the way objects are piped between commands is brilliant and very pow
by UltraSane 10mo ago
If you haven't tried PowerShell I strongly recommend you do. It is really well designed and the way objects are piped between commands is brilliant and very powerful. Combined with property filters you can do SQL like queries. The ConvertTo-JSON lets you export the output of any command to JSON which is amazingly useful. As an example you can dump the entire Active Directory (Assuming you have permissions) by
Get-ADObject -Filter * -Properties * | ConvertTo-JSON > ADObjects.json
And you have access to ALL of the .NET library.
- haolez 10mo agoUntil you have to quote a string that has ampersands in it :)
- ZenoArrow 10mo agoYou mean like this... ' "Here is an ampersand... &" ' To clarify, in PowerShell there is a difference between text between single quotes (e.g. '$test') and double quotes (e.g. "$test"). Single quote strings are literal strings, so whatever text is contained within them is reproduced as written. Double quote strings are expandable strings, which means that certain text inside the string is evaluated before it is returned. If you have double quotes in a literal string, you'll see double quotes within that string, and the same should be true for ampersands.
- haolez 10mo agoThat works in some cases, not others. I'm not saying that PowerShell is bad, but it certainly isn't a masterpiece of design.
- ZenoArrow 10mo agoWhat do you mean it works in some cases, not others? A literal string is a literal string in all cases. As for it being a "masterpiece of design", it has it's quirks but compared to common Unix shells (aside from Nushell) it's far better. It doesn't need to have a perfect design in order to be a step above the competition. I hope to continue to see the growth of Nushell, I can see that becoming the best shell one day.
- jborean93 10mo ago& has no special behaviour in strings, backticks and $ on the other hand do. For example "&Some String&" and '&Some String&' are all the literal value `&Some String&`. Backticks and $ are special in double quoted strings as they are the escape character and variable reference chars respectively.