2

I want to create an alias for 'jupyter notebook' in windows powershell. I ran the following command:

Set-Alias -Name jup -Value jupyter notebook

It triggered following error:

Set-Alias : A positional parameter cannot be found that accepts argument 'notebook'.
At line:1 char:1
+ Set-Alias -Name jup -Value jupyter notebook
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Set-Alias], ParameterBindingException
    + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.SetAliasCommand

Can someone please help me fix it?

KawaiKx
  • 9,558
  • 19
  • 72
  • 111
  • 1
    if "jupyter notebook" works from command prompt , then you should try Set-Alias -Name jup -Value "jupyter notebook" in quotes. – VGSandz Feb 09 '21 at 05:27
  • Does this answer your question? [How can I write a PowerShell alias with arguments in the middle?](https://stackoverflow.com/questions/4166370/how-can-i-write-a-powershell-alias-with-arguments-in-the-middle) – zett42 Feb 09 '21 at 07:42

1 Answers1

2

The problem comes from the fact that to start "jupyter notebook" you start the exe "jupyter" with parameter "notebook". To do so you have to create a function :

function jup {
    jupyter notebook
}

Then you can put this function in one of your profile files.

Sabuncu
  • 5,095
  • 5
  • 55
  • 89
JPBlanc
  • 70,406
  • 17
  • 130
  • 175