Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Powershell Parsing Question

$
0
0

I am very new to Powershell and was wondering if someone could help me out with parsing the following command as well as provide an explanation regarding the logic..

$BranchNumber = "2.14Main"
$MajorVersion =  $BranchNumber.Split('.')[0] 
$MinorVersion = $BranchNumber.Split('.')[1] 
$PatchVersion = $BranchNumber.Split('.')[2]
$HotfixVersion = $BranchNumber.Split('.')[3]

Write-Host $MajorVersion $MinorVersion $PatchVersion $HotfixVersion

The Write-Host that I am looking for needs to be the following.

2 14 0 0


Viewing all articles
Browse latest Browse all 21975

Trending Articles



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