Move flashing prompt sign away from left edge of PowerShell window

Post a reply


In an effort to prevent automatic submissions, we require that you complete the following challenge.
Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :| :mrgreen: :geek: :ugeek: :arrow: :angel: :clap: :crazy: :eh: :lolno: :problem: :shh: :shifty: :sick: :silent: :think: :thumbup: :thumbdown: :salute: :wave: :wtf: :yawn: :facepalm: :bravo: :dance: :beard: :morebeard: :xmas: :HeHe: :trollface: :cookie: :rainbow: :monkeysee: :monkeysay: :happybday: :headwall: :offtopic: :superhappy: :terms: :beer:
View more smilies

BBCode is ON
[img] is OFF
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Move flashing prompt sign away from left edge of PowerShell window

Re: Move flashing prompt sign away from left edge of PowerShell window

Post by A Keymaker » 06 Jan 2024, 06:14

This works

Write-Host "`r" # This clears the line
$Prompt = " " * 3 + " " # This last separate single white space can be entirely removed or changed into some other sign / text
Write-Host $Prompt -NoNewline
Read-Host


Well- kind off. Because even if I put this at the very top of a larger script or make the whole PS1 file consist of only this code then I still get to see the initial prompt sign(s) being right next to the left edge of PowerShell window [until the code reaches the point of displaying the prompt sign being space away in the line ready for input from user]

So does anyone have some other ideas how to move every prompt sign from the left edge; from the get-go and without using external files with profiles of some kind?

Move flashing prompt sign away from left edge of PowerShell window

Post by A Keymaker » 14 Sep 2023, 08:39

Is there a way to move the prompt sign in PowerShell [an also CMD] window more toward middle / right side of a it? So that a new empty line would flash it prompt sign as not being adjacent to the left edge of the window when awaiting for input from user?

This almost does what I need

Code: Select all

Countdown function
function Start-Countdown {
    $Countdown = 2
    while ($Countdown -gt 0) {
        Write-Host ("Countdown: $Countdown seconds") -NoNewline
        Start-Sleep -Seconds 1
        $Countdown--
        Write-Host "`r" -NoNewline
    }
}

# Start the countdown
Start-Countdown

# Clear the countdown line
Write-Host "`r"

# Modifications of prompt
$Prompt = " " * 2 + ""
Write-Host $Prompt -NoNewline

# Wait for input from user
Read-Host ""
as it shows
ppp:p_
instead of

Code: Select all

pppp
[where each >>p<< represent a white pause]

Where is that splitting >>:<< sign coming from? And more importantly: how to get rid of it?

Top