Skip to content

Instantly share code, notes, and snippets.

@jdmonty
Forked from fearthecowboy/make-alias.cmd
Last active August 29, 2015 14:08
Show Gist options
  • Save jdmonty/9fe816d1a1f9aa24e996 to your computer and use it in GitHub Desktop.
Save jdmonty/9fe816d1a1f9aa24e996 to your computer and use it in GitHub Desktop.
@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