python - 将参数从 Python 传递到 powershell
问题描述
我正在尝试从 Python 将参数传递给 powershell 脚本,但 powershell 只是拾取语句的第一部分并忽略空格后的所有内容这是代码:
p = subprocess.Popen(["C:/Windows/System32/WindowsPowerShell/v1.0/powershell.exe",
"C:/Users/fthoma15/Documents/testcase.ps1",
elem[2].replace('--','',1)], stdout=sys.stdout)
计算结果elem[2].replace('--','',1)
为 exec storecproc 值,但是当我运行代码时,powershell 只会选择 exec 部分并忽略其余部分。有没有办法逃避变量中的空间?
解决方案
推荐阅读
- javascript - redux thunk 函数是如何运作的?当一个 redux thunk 函数被调用时会发生什么?
- javascript - 更新失败的 Knexjs
- azure - 适用于 Java 的 Azure Application Insights 代理导致无法在 JBoss 18 上找到或加载主类 %JAVA_OPTS
- c# - 如何比较 SpecFlow 中的多行参数?
- c# - 在c#中使用/不使用正则表达式清除不需要的十六进制字符
- c++ - 为什么在三元中返回静态大小的数组时 MSVC 2019 会失败?
- javascript - 如何使用 JavaScript 和 Github API 更新托管在 GitHub 存储库中的 JSON 文件
- google-api - API 密钥对谷歌云翻译无效
- sql - Azure SQL 数据库中的 SQL 作业中的语法错误
- python - django中的url可以传入一个空字符串吗?