need to read an XML file and make an IF decision

Comments

2 comments

  • Dagannoth Rex

    I recommend using PowerShell, it can read XML files.

    It would look something like this:

    [XML]$C214 = Get-Content "c:\dassaultsystemes\C214"
    if ($C214.install_string -eq "V6R2103xE.HF9") {
    Write-Output "C214 already installed successfully, exiting"
    }
    0
    Comment actions Permalink
  • Bill Smith

    thx, i'll try that but did get this working as well:

    {
    $result = Select-String -path "C:\DassaultSystemes\C214\SftMgt\Install.xml" -pattern "V6R2013xE.HF9" -SimpleMatch
    if ( $result.count -gt 0 )
    {
    Write-Output "C214 already installed successfully, exiting install package"
    exit (2)
    }

    0
    Comment actions Permalink

Please sign in to leave a comment.