Search code examples
powershellcommandchain

Powershell shortcut on desktop: Chain two commands


I'm trying to create a shortcut on the desktop:

%windir%\system32\WindowsPowerShell\v1.0\powershell.exe -noexit -command import-module \\fs\PS\MyModule\MyModule.dll

That is working. Furthermore I want to read all commands of that module, after opening PS automatically. How do I append the following:

get-commands -Module MyModule

Thx piccus


Solution

  • try somesthing like this

    powershell.exe -noexit -command "& { import-module \\fs\PS\MyModule\MyModule.dll; ... others command ...}"