我正在使用批處理腳本讀取某些參數並啓動PowerShell腳本,該腳本需要輸入參數。使用批處理腳本中的參數運行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 ThisScriptsDirectory=%~dp0
SET PowerShellScriptPath=%ThisScriptsDirectory%Metrics.ps1
PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& '%PowerShellScriptPath%' 'arg1' 'arg2' 'arg3' 'arg4'";
Unfortunally PowerShell腳本不接受參數。
這個問題在[SO](http://stackoverflow.com/questions/19335004/how-to-run-a-powershell已回答-script-從-A-批處理文件)。我真的會遵循@deadlydog的鏈接。他的[博客](http://blog.danskingdom.com/allow-others-to-run-yow-powershell-scripts-from-a-batch-file-they-will-love-you-for-it/)非常好。 –
謝謝,我會記住 – Arturka1