powershell-3.0 - 用引号和斜杠替换字符串
问题描述
我在文件中有以下字符串:
应用程序=\“我的应用程序\”
我想用 PowerShell 命令删除它(或用''替换)。
我试过这个,但没有奏效:
powershell -Command "Get-ChildItem -Path ./Transform\*.json -recurse | ForEach {If (Get-Content $_.FullName | Select-String -Pattern ' where useraction.application=\\\"MyApp\\\"') {(Get-Content $_ | ForEach {$_ -replace ' where useraction.application=\\\"MyApp\\\"', ' '}) | Set-Content $_ -encoding UTF8}}"
我认为在每个特殊字符前面加上反斜杠会起作用,但到目前为止还没有运气。
解决方案
推荐阅读
- ios - 如何在ios中获取消息ID
- sql-server - 避免使用动态 SQL 在 UPDATE 触发器中递归
- amazon-web-services - 允许无服务器部署到生产环境的 AWS 策略仅适用于特定用户/组
- .htaccess - 如何阻止插件域目录访问
- javascript - MS Dynamics CRM - 如何测试帐户中是否存在 Notes 记录
- python - 存储过程多表 - PYODBC - Python
- amazon-web-services - 从 aws-cli 向 AWS EMR 集群提交 Spark 作业
- c++11 - 如何使用 std::result_of 返回函数类型而不是 void
- pyside - PySide gui、Maya hypershade 更新
- gradle - gradle 从 init 脚本覆盖插件存储库