Search This Blog

Call powershell script block from a batch script

You can use -Command option to execute a script block:
powershell -NoProfile -Command "[xml]$doc = Get-Content %DMCFG%; $te = $doc.DocumentElement.SelectSingleNode(\"token\"); if (-not $te) { $te = $doc.CreateElement(\"token\"); $doc.DocumentElement.AppendChild($te); }; $te.InnerText = \"%TOKEN%\";  $doc.Save(\"%DMCFG%\");"

No comments:

Post a Comment