26
ddit
34d

Powershell should die.

I have a simple bash script I made that allows me to download almost any video from the internet. Works great and took me only a few minutes to make.

The only issue is it bash meaning Windows doesn't run it natively. I am not able to install linux Subsystem or bash, etc on the server.

So I decided to rewrite it in powershell thinking it should be Okay and I have never struggled with so much retardedness in my life. After 40+ tabs in chrome and a massive headache, it finally works.

Microsoft should kill powershell entirely and rethink their scripting language.

Also VBA should have died 10 years ago.

Comments
  • 2
    P.S. I couldn't figure out how to do if not condition in powershell and got so frustrated I literally typed this piece of shit:

    if (Test-Path "video$i.ts") {
    } else {
    # code here
    }
  • 6
    @ddit first hit I got on google for powershell boolean expressions

    https://docs.microsoft.com/en-us/...
  • 1
    @Voxera for some reason this didnt show up for me and then I realized I didnt care at all. (All I wanted was to get it working than to make it perfect.)

    Also this doesn't feel natural at all to me:

    if (-Not (Test-Path ''))

    or

    if (!(Test-Path))
  • 4
    Powershell is abomination, the syntax is stupid and it fucking opens slow.
  • 5
    WSL can be installed on server 2019 or later.
    There are also MSYS and Cygwin if you need POSIX in Windows.

    Regarding powershell: At least I don't have to double check if I'm using quotes when referencing variables, if those could contain whitespace.
    Also I don't have to parse command output with awk.

    Anyway we are comparing apples with oranges here: Bash is mostly a shell, while Powershell is a .NET scripting language and an acceptable shell. Its advantages are powerful *built-in* commands, .NET access (thus access to low-level Windows functions) and object orientation (with object oriented pipes) and certainly not similatirty to bash. And certainly it is a huge improvement over batch or vbscript (and the latter seriously has to die).

    Back to bash: [ ! -f file ] isn't much better either...
  • 3
    @ddit disagree on the last sentence. Microsoft doesn't need to rethink their scripting, microsoft needs to stop trying to be the white fly and adopt bash so that we can have scripts which work on every os instead of having to always say "ah wait, that machine uses windows"
  • 2
    If it's just delegating to and executing a .ts file, why not just run it with ts-node?

    Powershell is absolute garbage for any number of reasons (differences on platforms, unclear error handling scenario/unhandleable errors, workflows that only exist on windows, the ability to compile and execute arbitrary code, oh god where did my ram go), but that just strikes me as personal preference/neophyte issues.
  • 4
    @ddit Bruh. Are you seriously complaining about powershell's if after comparing powershell to bash? With all the bloody double square brackets and significant whitespace and cryptic one letter operators. Try and remember what it was like to figure all that out
  • 1
    Oh yes. Im the go to dude for a friend that recently started in IT and she asked me to check an existing script with me and I gave up quite quickly. Also, it was a backup script - didn't want to play a hero. I'm saw quite some wheel inventions
  • 1
    Couldn't agree more
  • 6
    @M3m35terJ05h

    So true :)

    Also, PS has real objects so for more complex operations its superior.

    Bash is in no way more intuitive, its just older and something you just have to know to use linux.

    PS is much more optional for any normal user since most can be done through the gui.

    And no, ms do not need to rethink PS ;)

    Most will do fine without it, those who need scripting will mostly be able to install bash if they really want to, and the few thats left just have to use PS or select another OS.

    If PS is such an eye sore, then why use windows.

    And if you are forced to use it for dome program, ask your self, why does this not exist for linux, there might be a reason :P

    So I agree with you, instead of complaining on MS, consider why you are using windows.

    And don’t come dragging with their monopoly, they have never ever been that dominant in the server area, especially at the time they used bad practices.

    Their servers win their position because thy where easy yo use for small companies compared to linux/unix and novell netware.

    And I have worked with. All of them, even for a short while apples servers.

    A unix or linux server is very scary for a desktop user.
  • 1
    I mean... I don't like Bash either (though I use it a lot, sadly), but it's kind of a "lesser of two evils" case.

    Bash should go and commit a die.

    PowerShell should outright not have been fucking "born".

    Then again, it's M$... what did you expect them to do? design something that is easy and intuitive to use?
  • 0
    I haven't dug very deep down with Powershell, but on the surface I feel like I don't like it.

    As for your script, why don't you just use something that's platform-independent, i.e. Node?
  • 0
    I have been boycotting Powershell since ever.

    You are welcome.
  • 1
    My buggest fear regarding powershell is that someday it will run and mange linux as default. It might even merge with systemd. That would make the terminal of linux so painfull to me. There will always be bash, sure. But I bet the whole of the windows world would somehow make it mandatory to use powershell.
  • 0
    @SortOfTested in this case a .ts file is not TypeScript, it is a video file format that is used for online videos. I am downloading these .ts files and I then have to stitch them together to get the full video.
  • 0
    @M3m35terJ05h I only started using bash about 5 months ago. I learned it when I needed to setup automatic scheduled backups. It took me a few minutes of google and testing and I got a fully functional script.
  • 3
    @sbiewald and you can easily write and execute C# code which makes things incredibly neat
  • 0
    Powershell is kryponite to linux sysadmins. What I've struggled with is when I found a powershell way to get (using parameter get!) some state, but had to use some completely unrelated command to change the state (set parameter missing from powershell command).
    I was setting up some automation using puppet.
Add Comment