Background story
Recently, I have playing around with Windows scripting to perform automation of installation process.
Fun fact
I haven't do any scripting before in Windows platform, and this is the first I've tried.
So, what's different between linux and windows in terms of scripting?
- backslash in the path, WTF?
- msiexec need the installer's absolute, full path in order to work, WTF?
- escape character is
^
instead of\
, WTF? - runas instead of sudo, it require user to interact with a button by clicking it instead of enter some password, WTF?
- you can't escalate privilege on current terminal session legally and officially. you must spawn new terminal in order to achieve that. WTF?
- beware of error in your bat or cmd script! sometimes it gives you vague error and at the end you realize it just a typo or smth.
- why I need to escape any parenthesis inside if block? WTF?
Yeah, that's new to me.
another Windows quirks
- in CMD shell, you must use double quote for path that contain spaces, single quote won't work! try this:
dir 'C:\Program Files\Tailscale\'
- when SSH to your Windows machine and enter msys2 shell, and frustating why
/accepteula
not working when it should, remember this: MSYS2_ENV_CONV_EXCL - when things don't work the way you expect in msexec, try enable verbose log:
/l*v .\installer.log
and dump the log to the AI and let 'em figure out the problem! grok tell me the problem is just wrong path. %temp%
folder isn't really temporary, it will be there forever until some program or user itself decided to delete it, lol.