I want to create an alias in my Profile.ps1
running a bunch of commands. I have separated each command with a semicolon:
New-Alias -Name venv -Value 'echo "venv" >> .gitignore ; python3 -m venv --copies venv ; venv\scripts\activate.ps1 && pip install -U pip pylint black pep8 pydocstyle ; pip list ; python --version' # Create virtual environment "venv"
However, this errors out with the following:
venv : The module 'echo "venv" >> .gitignore ; python3 -m venv --copies venv ; venv' could not be loaded. For more information, run 'Import-Module echo "venv" >> .gitignore ; python3 -m venv --copies venv ; venv'.
At line:1 char:1
+ venv
+ ~~~~
+ CategoryInfo : ObjectNotFound: (echo "venv" >> .git\u2026 ; python --version:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CouldNotAutoLoadModule
If I simplify the command down to New-Alias -Name venv -Value 'echo "venv" >> .gitignore'
I still get an(other) error:
venv : The term 'echo "venv" >> .gitignore' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ venv
+ ~~~~
+ CategoryInfo : ObjectNotFound: (echo "venv" >> .gitignore:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
What am I doing wrong here?