I'm trying to create a powershell alias for my ng build command which is fairly long.
node --max_old_space_size=4096 .\node_modules\@angular\cli\bin\ng build --configuration=debug --watch
Aliasing the command directly using Set-Alias -Name ngBuild -Value node --max_old_space_size=4096 .\node_modules\@angular\cli\bin\ng build --configuration=debug --watch doesn't work for me.
Set-Aliasis meant for cmdlets / functions, not to storescriptblocks. I guess, an option you have is to store your command inside a function with that name you wanted.bash, you cannot include pass-through arguments in a PowerShell alias definition - you need a function for that. PowerShell aliases are simply alternative names for other commands, with no ability to "bake in" arguments. E.g., to define a short commandbarthat invokes commandfoowith fixed argumentbarwhile passing all other arguments through, usefunction bar { foo bar @args }- see the linked duplicate for more information.