PowerShell setting prompt command to different characters;
There might be a need for you to set PS prompt to preferred character, such as working space considerations or you think it will look cool, or have some fun within your scripts. If that is the case you can use following snippets to get started.
#(-)_.Function set prompt to hash-symbol
Function Prompt {
return "#";
}
#(-)_.Function set prompt to following;
Function Prompt {
return "M365#>";
}
#(-)_.Function set prompt to following;
Function Prompt {
return "Shell>";
}
#(-)_.Function set prompt to following;
Function Prompt {
return "*";
}
#(-)_.Function set prompt to following;
Function Prompt {
return "$";
}
#(-)_.Function set prompt to following;
Function Prompt {
return "@";
}
#(-)_.Function set prompt to following;
Function Prompt {
return "M365>";
}
#(-)_.Function set prompt to following;
Function Prompt {
return "OZ>";
}
#(-)_.Change the command promp hash-symbol
function Prompt
{
Write-Host ("(M365-EPS) " + $(get-date) +">") -nonewline -foregroundcolor cyan
return "#";
}
|
Azure Solutions Architect
AWS Certified Cloud Practitioner
Azure Certified Security Engineer Associate
No comments:
Post a Comment