json - 以 JSON 格式转义双引号 - powershell,azure cli
问题描述
请我尝试将 html 字符串作为值从 azure cli 传递给下面的 powershell 函数“set-content”,但我认为我没有正确转义双引号。value 参数只接受字符串,不知何故,它不会在目标机器上用双引号执行。我收到以下错误。请帮忙!
az vm extension set --name CustomScriptExtension --vm-name MyWindowsVM -g TestsandRG --publisher Microsoft.Compute --settings '{"commandToExecute": "powershell set-Content -Path \"C:\\inetpub\\wwwroot\\Default.htm\" -Value \"<html><body><h2>Welcome to Azure! My name is $($env:computername) .<\/h2><\/body><\/html>\""}'
解决方案
推荐阅读
- python - 创建对象并将数据批量上传到 django 模型中
- google-bigquery - Bigquery unnest 最小行数
- ios - 如何使用 JSON 在 SwiftUI 中为 Google 地图设置样式
- angular - 如何从字符串中解析svg
- excel - 如何要求用户只在用户窗体中输入一个五位数字?
- amazon-cloudformation - 如何在 CloudFormation 模板中为 Athena NamedQueries 指定工作组?
- python - 无法在 Python 中抑制 DeprecationWarning
- go - go编译器如何优化字符串常量的存储?
- github - 禁用从注释文件运行的 Github 操作检查
- excel - 根据标题返回数组