Below is a snippet of my html code, which is defined as $ html in my Powershell script:
$html = @"
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="/js/lib/dummy.js"></script>
<link rel="stylesheet" type="text/css" href="/css/result-light.css">
<link rel="stylesheet" type="text/css" href="https://rawgit.com/pguso/jquery-plugin-circliful/1.0.2/css/jquery.circliful.css">
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<script type="text/javascript" src="https://rawgit.com/pguso/jquery-plugin-circliful/1.0.2/js/jquery.circliful.js"></script>
<style type="text/css"></style>
<title>Orders</title>
</head>
<body>
<div class="container">
<h3 style="text-align: center; margin-top: 2%; font-size: 300%">Actual Vs Expected orders for Today:</h3>
<h2 style="text-align: center; color: #ff3333; margin-top: 2.5%; font-size: 500%">$SAPTodayExel<small style="color: #000000">/$ExpectedExelOrders</small></h2>
<div class="col-lg-12">
<div id="test-circle"></div>
<table style="margin-top: 100px; width:75%; position: fixed; bottom: 40px;">
<tr>
<th style="font-size: 16px; width:11%; background: linear-gradient(to bottom, #f0f9ff 0%,#cbebff 49%,#a1dbff 100%)">12</th>
<td style="font-size: 30px; color: #ff3333; width:20%; background: linear-gradient(to bottom, #f0f9ff 0%,#cbebff 49%,#a1dbff 100%)">$SAPTodayNonConExel</td>
<th style="font-size: 16px; width:8%; background: linear-gradient(to bottom, #f0f9ff 0%,#cbebff 49%,#a1dbff 100%)">13</th>
<td style="font-size: 30px; color: #ff3333; width:20%; background: linear-gradient(to bottom, #f0f9ff 0%,#cbebff 49%,#a1dbff 100%)">$SAPTodayPOSExel</td>
<th style="font-size: 16px; width:8%; background: linear-gradient(to bottom, #f0f9ff 0%,#cbebff 49%,#a1dbff 100%)">24</th>
<td style="font-size: 30px; color: #ff3333; width:15%; background: linear-gradient(to bottom, #f0f9ff 0%,#cbebff 49%,#a1dbff 100%)">$SAPTodayROIExel</td>
<th style="font-size: 16px; width:7%; background: linear-gradient(to bottom, #f0f9ff 0%,#cbebff 49%,#a1dbff 100%)">245</th>
<td style="font-size: 30px; color: #ff3333; width:20%; background: linear-gradient(to bottom, #f0f9ff 0%,#cbebff 49%,#a1dbff 100%)">$SAPTodayUnited</td>
</tr>
</table>
</div>
</div>
</head>
<script type='text/javascript'>
window.onload=function(){
$( document ).ready(function() {
$("#test-circle").circliful({
foregroundColor: "#cb60b3",
backgroundColor: "#e5e7e9",
pointColor: "none",
fillColor: 'none',
foregroundBorderWidth: 15,
backgroundBorderWidth: 15,
pointSize: 28.5,
fontColor: '#aaa',
animation: 1,
animationStep: 5,
showPercent: 1,
noPercentageSign: false,
replacePercentageByText: null,
percentageTextSize: 22,
percent: $PercentReceived,
multiPercentage: 0,
percentages: null,
targetPercent: null,
targetTextSize: 12,
targetColor: '#2980B9',
icon: 'none',
iconSize: '30',
iconColor: '#ccc',
iconPosition: 'top',
target: 0,
start: 0,
textBelow: true,
text: null,
textStyle: "font-size: 10px",
textColor: '#17202a',
textAdditionalCss: 'test',
halfCircle: false,
animateInView: false,
decimals: 0,
alwaysDecimals: false
});
});
}
</script>
</html>
"@
$html | out-file "c:\test.html"
When I run this as an html file, it works perfectly fine and the script works as expected. However, if I parse this through PS, an error occurs:
document: the term βdocumentβ is not recognized as the name of a cmdlet, function, script file, or operating program. Check the spelling of the name or inclusion of the path, make sure the path is correct and try again. On the line: 46 char: 6 + $ (document) .ready (function () {// 6.32 5.38 2.34 + ~~~~~~~~ + CategoryInfo: ObjectNotFound: (document: String) [ ], CommandNot FoundException + FullyQualifiedErrorId: CommandNotFoundException
"$ (document)" "$ (" document "), , , , , html , " $( "" )", script - .
, PS? ?