Quantcast
Channel: Windows PowerShell Forum
Viewing all articles
Browse latest Browse all 2562

Extra space in write-host output

$
0
0

I have function in a module which returns a paths -

function PoshPath([string] $tag)
{
	switch ($tag)
	{
		"sql"     { return $psscriptroot+"\scripts\sql" }
		"private" { return $psscriptroot+"\scripts\private" }
		"public"  { return $psscriptroot+"\scripts\public" }
		"sql"     { return $psscriptroot+"\scripts\sql" }
		default   { return $psscriptroot }
	}
}


I am facing a peculier issue where in the return string of the function is been appended with space,

I realized the issue is nothing related to a function as in the second call to write-host I can see the space inserted between Hello and \*.ps1.

Why this extra space added and how can I get rid of this?

Thanks,

Shiju Samuel


Viewing all articles
Browse latest Browse all 2562

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>