使用批处理脚本中的参数运行PowerShell脚本
我正在编写一个批处理脚本,以读入一些参数并启动PowerShell脚本,该脚本需要键入的参数 到目前为止我所做的:使用批处理脚本中的参数运行PowerShell脚本,powershell,batch-file,Powershell,Batch File,我正在编写一个批处理脚本,以读入一些参数并启动PowerShell脚本,该脚本需要键入的参数 到目前为止我所做的: Set /p arg1 = Type in a name for the data: Set /p arg2 = Type in the directory of the project: Set /p arg3 = Type in the programming language : Set /p arg4 = Type in a version for the m
Set /p arg1 = Type in a name for the data:
Set /p arg2 = Type in the directory of the project:
Set /p arg3 = Type in the programming language :
Set /p arg4 = Type in a version for the metric data:
SET ThisScriptsDirectory=%~dp0
SET PowerShellScriptPath=%ThisScriptsDirectory%Metrics.ps1
PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& '%PowerShellScriptPath%' 'arg1' 'arg2' 'arg3' 'arg4'";
不幸的是,PowerShell脚本不接受这些参数。您的变量名后面有一个空格(“随便什么”)。失去等号前后的空格:
Set /p arg1=Type in a name for the data:
Set /p arg2=Type in the directory of the project:
Set /p arg3=Type in the programming language :
Set /p arg4=Type in a version for the metric data:
变量名后面有一个空格(“随便什么”)。失去等号前后的空格:
Set /p arg1=Type in a name for the data:
Set /p arg2=Type in the directory of the project:
Set /p arg3=Type in the programming language :
Set /p arg4=Type in a version for the metric data:
这个问题已经在第页得到了回答。我真的会关注@deadlydog的链接。他的回答很好。谢谢,我会记住的。这个问题已经在回答了。我真的会关注@deadlydog的链接。他的回答很好。谢谢,我会记在心里的现在几乎没有我的答案?现在几乎没有我的答案?