Q is not recognized as an internal or external command

Same problem for me in Windows…

[SOLVED on win]

I had issue on win 10 :

q♦ : The term 'q♦' is not recognized as the name of a cmdlet...

I was trying to create a q command to exit PowerShell quickly:

Set-Alias q exit

But it didn’t work — even after adding it to my $PROFILE.

Root causes and solution:

  • The execution policy was set to Restricted, so the profile script wasn’t running.
  • Fixed with:
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned

Still, the alias failed, but luckly ‘function’ works fine :slight_smile:

Working solution:

Define a function in profile ( PowerShell → notepad $PROFILE ):

function q { exit }

This works reliably and can be placed in $PROFILE.

Hope this helps others facing the same problem.

Same problem for me in Windows10 CMD.exe

Same problem here Windows 11