【发布时间】:2017-05-05 17:17:53
【问题描述】:
我目前正在尝试制作一个使用 Visual Studio 预构建的应用程序。
作为我的命令,我有很多使用相同部分的命令,比如说:
powershell.exe -ExecutionPolicy unrestricted C:folder1\bin\something.exe "variable1" "variable2"
powershell.exe -ExecutionPolicy unrestricted C:folder1\bin\something.exe "variable1" "variable2"
powershell.exe -ExecutionPolicy unrestricted C:folder1\bin\something.exe "variable1" "variable2"
powershell.exe -ExecutionPolicy unrestricted C:folder1\bin\something.exe "variable2" "variable4"
powershell.exe -ExecutionPolicy unrestricted C:folder1\bin\something.exe "variable3" "variable5"
我想在顶部设置一个变量来接受不变的内容,所以:powershell.exe -ExecutionPolicy unrestricted C:folder1\bin\something.exe
我目前正在这样做:
SET VAR = powershell.exe -ExecutionPolicy unrestricted C:folder1\bin\something.exe
and trying to call it this way :
VAR "variable1" "variable2"
VAR "variable1" "variable2"
VAR "variable1" "variable2"
VAR "variable2" "variable4"
VAR "variable3" "variable5"
但这不起作用,请注意为什么?
【问题讨论】:
-
这和C#有什么关系?
标签: powershell environment-variables