Updated Powershell Scripts
For those who are interested, I just uploaded a bunch of changes to the PowerShell Scripts folder on my SkyDrive. Feel free to download them and use them as you need.
- find-to-set-alias – Brad Wilson enhanced this function significantly and broke it out into it’s own script. I had a small issue with his version where the folder search may only return a single value, so you can’t treat it like collection. My version wraps that command in @(...) so that you can always treat it like a collection.
- find-in-path – searches all the folders in your path for a given file name (wildcards supported. Very useful for "where is this app actually installed" kind of debugging.
- get-git-branch – returns the current git branch of a given folder. Got the idea for this originally from Ivan Porto Carrero.
- prompt – my powershell prompt. Pretty basic, but it now shows current git branch.
- elevate-process – create a new PowerShell window or run an app as an administrator. I alias this to su on my machine. I recently reworked the "run an app" part of this script, so it will search the current folder and then the path to run the app you specify.
- _profile – this is my main profile script, which I share across multiple machines via Mesh. I reworked all my alias setting to use the new find-to-set-alias and moved setting the color of the command window to the top of the script.
Update: I just updated elevate-process again, adding a special clause to handle .bat and .cmd files. cmd.exe seems to ignore the working directory setting, so if your batch file relies on being run from the folder it’s in, it’ll break with elevate-process. That’s annoying. So if you elevate a batch file, the script runs cmd.exe directly and executes the specified batch file after first changing to the current directory. Ugly, but it seems to work.
This entry was posted by DevHawk on April 29, 2009.
It was posted in Development.
It was tagged PowerShell.
Comments:
Nice - I like the cleanness of your usage of find-to-set-alias in your prompt. Definitely makes working with versioned folders nicer.
I'm curious, is there something your find-in-path does that the get-command cmdlet doesn't do?
Thanks for sharing!
This comment was posted by David Mohundro
on May 11, 2009 at 3:26 PM.
Categories
Tags
ASP.NET (31)
Blogging (128)
C# (18)
Community (81)
dasBlog (12)
Database (13)
Debugger (23)
DLR (25)
Domain Specific Languages (15)
Dynamic Languages (12)
Entertainment (14)
ETech (15)
F# (51)
Family (33)
Functional Programming (18)
Games (18)
Hockey (34)
IronRuby (16)
Lanugages (43)
LINQ (24)
Microsoft (31)
Modelling (61)
Movies (23)
Music (20)
Parsing Expression Grammar (16)
PowerShell (41)
REST (18)
Ruby (23)
Service Broker (14)
Silverlight (20)
SOA (94)
Visual Studio (21)
Washington Capitals (43)
WCF (31)
Web 2.0 (67)
Web Services (12)
WF (21)
Windows Live (29)
Working at MSFT (23)
Xbox 360 (54)
XNA (15)
Series
Disclaimer
The information in this weblog is provided "AS IS" with no warranties,
and confers no rights. This weblog does not represent the thoughts,
intentions, plans or strategies of my employer. It is solely my opinion.
Inappropriate comments will be deleted at the authors discretion.