So, I'm new to powershell, so just bear with me here.
I'm using powershell to create a command prompt, and most of it, is just functions, and if statments, when i try to use a 'else' statement, with 'Write-Output', it leaves a blank new line, heres my code;
while ($true) {
$Title = "Falcon Os v1 alpha cli"
$host.UI.RawUI.WindowTitle = $Title
$global:current_path=Get-Location
$global:current_path=$global:current_path.Path
$starterterminalpromptone = $current_path
$starterterminalprompttwo = " >>> "
$prompt = $starterterminalpromptone + ". Type 'sys.win.man.help' for help " + $starterterminalprompttwo
Write-Host $prompt -NoNewLine
$command = $Host.UI.ReadLine()
if ($command -eq "sys.win.info.nl") {sys.win.info.nl}
if ($command -eq "sys.win.man.help") {sys.win.man.help}
if ($command -eq "sys.command.output.out.echo.command.variable") {sys.command.output.out.echo.command.variable}
if ($command -eq "sys.exit") {break}
if ($command -eq "sys.path.cd") {sys.path.cd}
if ($command -eq "sys.path.view") {sys.path.view}
if ($command -eq "sys.screen.cls") {cls}
if ($command -eq "sys.path.mkdir") {sys.path.mkdir}
if ($command -eq "sys.path.makefile") {sys.path.makefile}
if ($command -eq "sys.win.cleartext.vtext.show") {sys.win.cleartext.vtext.show}
elseif ($cs -eq "start"){Write-Output ""}
elseif($cs -eq "command"){Write-Output ""}
else {Write-Output "Unknown command."}
}
By the way, all my if statemnts lead to mostly functionns, but made it the only part i need.
What it does when i put a unknown command, it simply leaves a blank new line.
I use powershel 7.20, and use ISE to edit my code.
Aucun commentaire:
Enregistrer un commentaire