Add variable in HTML

Welcome Forums General PowerShell Q&A Add variable in HTML

Viewing 1 reply thread
  • Author
    Posts
    • #211086
      Participant
      Topics: 7
      Replies: 6
      Points: 29
      Rank: Member

      Team,

      Please provide a sample code where I can call PS var in raw HTML language. convertto-html has some limitation & can’t go some advance formatting with  convertto-html . Given a sample HTML code where I need to call PS variable.

      <html>
      <head>
          <link rel=”shortcut icon” href=”icon link”/>
          <title>NDES Certificates Expiry</title>
          <meta http-equiv=”content-type” content=”text/html; charset=utf-8″ />
          <style type=”text/css”>
              div {
                  background-color: green;
              }
          </style>
      </head>
      <body>
              <h3 style=”color:white;”>
                  <font face=”Calibri”><center>test </center></font>
      </body>
      </html>

       

      • This topic was modified 2 months, 2 weeks ago by Biswajit.
    • #211116
      Participant
      Topics: 0
      Replies: 1
      Points: 18
      Rank: Member

      maybe this?

      $HTML =
      @”
      <html>
      <head>
          <link rel=”shortcut icon” href=”icon link”/>
          <title>NDES Certificates Expiry</title>
          <meta http-equiv=”content-type” content=”text/html; charset=utf-8″ />
          <style type=”text/css”>
              div {
                  background-color: green;
              }
          </style>
      </head>
      <body>
              <h3 style=”color:white;”>
                  <font face=”Calibri”><center> VARIABLEHERE </center></font>
      </body>
      </html>

       

      “@

       

      $Variable = “VARIABLEHERE”
      $ReplaceWith = “NEWSTUFF”
      $HTMLReplaced = $HTML -replace $Variable,$ReplaceWith
Viewing 1 reply thread
  • You must be logged in to reply to this topic.