Best practice for Invoke other scripts or exe in PowerShell
Recently, I find I used many different type method to invoke other scripts or exe in PowerShell. Maybe by start new process, or just use the call operator &. That's fine. But I want to mention there's one preper way to invoke other scripts or exe in PowerShell I'd like to use.
Problem background:
I want to run msbuild to build something, but I want to sepcify multi folders. e.g. I want to output to both 'C:\output' and 'D:\output'. So, what should I do ?
I may use the call operator & directly like:

What's wrong ? Can you find it ?
Actually, The real OutputFolder property value would be: "C:\output, D:\output".
And the whole script will be tranlated to:
& .\msbuild.exe YOUR_PROJECT.csproj /t:$Targets /p:C:\output, D:\output
msbuild.exe will report something like, property is invalid or cannot distinguish and so on. Because the wired comma exists.
Sulotion:

Create a argument array, and use double quote to quote the property value to make true the quote will in the property value.
Done.
Best practice for Invoke other scripts or exe in PowerShell的更多相关文章
- Fatal error in launcher: Unable to create process using '"c:\python37\python3.exe" "C:\Python37\Scripts\pip3.exe" install opencv-python'
pip3.exe install opencv-python 报错: Fatal error in launcher: Unable to create process using '"c: ...
- pip3命令报错Fatal error in launcher: Unable to create process using '"d:\old_files\py3.6\python.exe" "E:\py3.6\Scripts\pip3.exe" list'
cmd输入pip3 list命令报错 Fatal error in launcher: Unable to create process using '"d:\old_files\py3.6 ...
- python:python2与python3共存时,pip冲突,提示Fatal error in launcher: Unable to create process using '"d:\python27\python2.exe" "D:\Python27\Scripts\pip2.exe" '
问题背景: 机器上同时装了python2.和python3后,导致只能用pip3了,使用pip2时提示:Fatal error in launcher: Unable to create proces ...
- AutoCAD.NET 不使用P/Invoke方式调用acad.exe或accore.dll中的接口(如acedCommand、acedPostCommand等)
使用C#进行AutoCAD二次开发,有时候由于C#接口不够完善,或者低版本AutoCAD中的接口缺少,有些工作不能直接通过C#接口来实现,所以需要通过P/Invoke的方式调用AutoCAD的其他DL ...
- 【Selenium】【BugList4】执行pip报错:Fatal error in launcher: Unable to create process using '""D:\Program Files\Python36\python.exe"" "D:\Program Files\Python36\Scripts\pip.exe" '
环境信息: python版本:V3.6.4 安装路径:D:\Program Files\python36 环境变量PATH:D:\Program Files\Python36;D:\Program F ...
- python pip使用报错: Fatal error in launcher: Unable to create process using '"c:\python27\python.exe" "C:\Python27\Scripts\pip.exe" '
在一个系统中,如果同时存在python2和python3,在cmd.exe程序下执行pip.pip2或者pip3均会报错. 如何解决: 如果是在python3环境下,使用pip安装扩展库,可以使用以下 ...
- 使用Anaconda的python安装虚拟环境是出现错误:python -m venv venvdir----Error: Command '['D:\\Development\\Django\\test\\Scripts\\python.exe', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit
在创建python虚拟环境的时候,如果使用的是Anaconda中集成的python -m venv venvdir就会出现不能安装pip的错误,原因是Anaconda没有ensurepip, 解决办法 ...
- python的py文件打包成exe
一.首先需要安装Pyinstaller-- 使用pip来安装模块 (我电脑上装的是python的一个编译环境Anaconda,如果电脑上装的是python自带的IDE的话,就直接进入python的安装 ...
- PyQt5安装目录中找不到designer.exe与pyrcc5.exe
我安装的是PyQt5的5.9版本,在安装目录下找不到designer.exe文件.在摸索一段后发现5.9版本对库文件和相关的开发工具是分开发布的.QtDesigner是在pyqt5-tools的包里. ...
随机推荐
- Hdu Binary Tree Traversals
Problem Description A binary tree is a finite set of vertices that is either empty or consis ...
- 简单C#文字转语音
跟着微软走妥妥的,C#文字转语音有很多参数我就不说了,毕竟我也是初学者.跟大家分享最简单的方法,要好的效果得自己琢磨喽: 先添加引用System.Speech程序集: using System; us ...
- 全局通知Notification
Notification 全局通知 关于全局通知的个人理解: 即有一个发射消息的,在整个应用中任何对象都可以接受这个消息 但是无论是哪个对象接受消息,都要在这个对象结束时移除消息 简单的说 就是给对象 ...
- BZOJ 3170: [Tjoi 2013]松鼠聚会( sort )
题目的距离为max(|x1-x2|, |y1-y2|) (切比雪夫距离). 切比雪夫距离(x, y)->曼哈顿距离((x+y)/2, (x-y)/2) (曼哈顿(x, y)->切比雪夫(x ...
- Linux学习之crontab定时任务
为当前用户创建cron服务 1. 键入 crontab -e 编辑crontab服务文件 例如 文件内容如下: */2 * * * * /bin/sh /home/admin/jiaoben/bu ...
- 创建XML文件
//创建XML文件 XmlDocument xmldoc = new XmlDocument(); XmlText xmltext; ...
- Django Web开发【3】创建网络收藏夹
这一节我们将继续一个创建网络收藏夹应用,并学习视图.模型以及模板的处理过程. Django是一个MVC开发框架,但是它的控制器对应的为view,而视图对应为模板(template),模型对应model ...
- JAVA之GUI编程窗体事件
package GUI; import java.awt.Button;import java.awt.FlowLayout;import java.awt.Frame;import java.awt ...
- codeforces 632D. Longest Subsequence 筛法
题目链接 记录小于等于m的数出现的次数, 然后从后往前筛, 具体看代码. #include <iostream> #include <vector> #include < ...
- 【LeetCode题意分析&解答】41. First Missing Positive
Given an unsorted integer array, find the first missing positive integer. For example,Given [1,2,0] ...