我有一个PS脚本,该脚本应生成带有添加内容$ datei的html文件。工作正常,但这是问题所在,我有这样的东西:
"some html...
<textarea id="Text$counter" style="width: 100%; height: 100%;"></textarea>
some html...
<span>$NameEdit</span>
some html...
document.getElementById('Text$counter').select();
some html...
" | add-content $datei
所以我在html部分中有multible double和single qoutes和multible变量,但是我无法找出如何逃脱脚本按预期运行的所有内容,并在html代码中填写变量
使用PS 7.0的即时消息
此处字符串但是您也可以使用转义字符`
@"
some html...
<textarea id="Text$counter" style="width: 100%; height: 100%;"></textarea>
some html...
<span>$NameEdit</span>
some html...
document.getElementById('Text$counter').select();
some html...
"@ | add-content $datei
要使用,您需要先输入这里字符串
@"
或@'
,然后在新行中放置字符串。然后,要关闭此处字符串,您将需要换行并输入"@
或'@
。 "@
或'@
必须在新行的最开始处。这里有一些失败的例子#This will NOT work
@"
Hey There "Buddy"
"@
#This will NOT work
@"Hey There "Buddy""@
#This will NOT work
@"
Hey There "Buddy""@
这里有几个正确工作的例子
#This WILL work @" Hey There "Buddy" "@ #This WILL work @" Hey There "Buddy" "@ #This WILL work $Test = @" Hey There "Buddy" "@
它确实使美化代码更加困难范例
Function Test(){ $Text1 = "Hello There" $Text2 = @" "Buddy" "@ return "$Text1 $Text2" }
现在让我们越过转义字符它称为Backtick。`
"Hey There `"Buddy`""
等于Hey There“ Buddy”