In dealing with data transferred between different operating systems, we often come across the irritating phenomenon of, what might appear as, a file without any spaces in them. This is of course because of different end of line (EOL) characters, and I’m going to show you a quick and easy way of using PowerShell to “fix” these for Windows. (more…)
Tag: PowerShell
Invoke-WinMerge
Doing file compares can be quite confusing using Compare-Object, so unless you only want to check for equality, using a GUI can be tremendously helpful. Enter WinMerge. I guess most of you have used, or are currently using, this fabulous tool. I created a simple wrapper for WinMerge so that it’s easier than ever to open file (or folder) comparison right from the PowerShell console. (more…)
View Steam wishlists with PowerShell
With Steam having frequent sales, I find I often pop into my own, as well as my friends wishlists to plan purchases. Wouldn’t it be great to be able to list a wishlist from the PowerShell console? (more…)
Get-RootMeanSquare
Ever needed to get the Root Mean Square of a set before? Me neither, but I went ahead and created a small function for it anyway. (more…)
Observations on writing to Screen and File in PowerShell
When writing a PowerShell script, you are typically doing “something” with “something” and getting a result based on this “doing”.
This is all well and good, but after you have gotten your result what do you do with the data? Two common scenarios are writing the result either to the screen or to a file. If the script is doing a lot of calculations, it’s quite common to also give the user some kind of feedback while it’s working, to indicate that it’s actually doing what it’s suppose to do and that it haven’t stalled. (more…)
Pro tip: Choosing the best collection for the job
You need to store a collection of data of some sort, so you stuff it in an array, problem solved, right? But is an array the best solution for your script? And should you care? (more…)
Progress Bar and Seconds Remaining
In my last post about using progress bars in PowerShell, we went through the basic usage, as well as nesting of progress bars. There was however one parameter that I didn’t discuss, and that I seldom see used; the SecondsRemaining parameter. (more…)
Quick tip: Enums with FlagsAttribute
If you have worked with PowerShell for a while, chances are you are familiar with Enums. If you have also worked with more traditional programming languages you definitely are familiar with Enums!
Enums can have custom attributes, and one such attribute is the topic this quick tip; the FlagsAttribute! (more…)
Quick tip: Easy access to special symbols
In this quick tip, I’m going to show you a way to organize and quickly access special symbols in PowerShell. (more…)
ConvertTo-UNCPath
Converting a path to UNC path doesn’t really take that many lines of code, but having recently been in a project where I needed to do this a lot, I got tired of copy-pasting the same 2-3 lines of code back and forth, and decided to create a helper function out of it. (more…)