Created
October 28, 2014 01:38
-
-
Save fearthecowboy/949bda3fc86be33f1997 to your computer and use it in GitHub Desktop.
Script to create cmd-aliases for powershell module commands.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
: make-alias.cmd | |
if "%1" == "" goto usage: | |
for /F "usebackq" %%v in (`"powershell $M = ipmo -PassThru "%1" ; $M.ExportedCommands.Keys"`) do doskey %%v=powershell ipmo "%1" ; %%v $* | |
echo Aliases: | |
doskey /macros | |
goto done | |
:usage | |
echo Usage: | |
echo. | |
echo make-alias PSMODULE | |
echo. | |
echo. | |
echo PSMODULE should either be a path to a module (psm1 or psd1) | |
echo or a powershell module name | |
echo. | |
echo eg: make-alias c:\path\to\oneget.psd1 | |
echo. | |
echo. | |
:done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment