简体   繁体   中英

Creating Alias in Windows Powershell

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?

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM