Screen saver clock windows 109/7/2023 ![]() ![]() Just think of it as shell scripting in a more pythonic environment and it's not terrible. Having a 1/4 century of bash experience, powershell is very strange, but also a bit refreshing to work with. ( Learn more here.) A slightly less convenient alternative is Get-Member. Unfortunately, installing it now requires the -AllowClobber option. (I have to admit that even though I can write sed directly into a script without testing it at the CLI, this IS better.) There is a useful tool for exploring objects that is recommended by a Microsoft technet blogger. We access a single property with the convenient dot notation. Here, the Get-ItemProperty returns an object that has many properties. This is a pretty succinct demonstration of how powershell returns objects (complete with methods, accessors, etc.) rather than streams of text like bash. That value just happens to be a complete path to a *.scr file, and therefore you can (and I do) tell powershell to run it as a command. ![]() ![]() This will get the value of the SCRNSAVE.EXE property from the registry. Powershell.exe -command "& (Get-ItemProperty 'HKCU:Control Panel\Desktop')." # This works from both WSL/bash and powershell! To make this a legitimate SO answer, I'll include the simpler one: #!/bin/bash ![]()
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |