Powershell 预构建的SET环境变量不';行不通
我目前正在尝试制作一个使用VisualStudio预构建的应用程序 作为我的命令,我有许多使用相同命令部分的命令,比如:Powershell 预构建的SET环境变量不';行不通,powershell,environment-variables,Powershell,Environment Variables,我目前正在尝试制作一个使用VisualStudio预构建的应用程序 作为我的命令,我有许多使用相同命令部分的命令,比如: powershell.exe -ExecutionPolicy unrestricted C:folder1\bin\something.exe "variable1" "variable2" powershell.exe -ExecutionPolicy unrestricted C:folder1\bin\something.exe "variable1" "variab
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"
但这行不通,有人知道为什么吗
我发现了问题,设置VAR=“something”
“=”之间不能有空格为什么调用powershell只是为了调用另一个可执行文件?为什么不直接调用可执行文件并跳过Powershell层呢
SET VAR="C:folder1\bin\something.exe"
VAR "variable1" "variable2"
VAR "variable1" "variable2"
VAR "variable1" "variable2"
VAR "variable2" "variable4"
VAR "variable3" "variable5"
这与C#有什么关系?我必须验证脚本中的可执行文件是否是最新的,如果是,就不要编译它。我认为最好的方法是制作一个powershell脚本。你有更好的主意吗?