powershell脚本中的位置参数错误 [英] Positional Parameter error in powershell script

查看:61
本文介绍了powershell脚本中的位置参数错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图通过 PowerShell 安装/更新 EPO 代理,但出现以下错误.我是 PowerShell 的新手,所以我无法看到是什么导致了这种情况.

I was trying to install/update EPO agent through PowerShell, but I am getting below error. I am new to PowerShell so I am not able to see what is causing this.

下面是我用来更新代理的脚本:

Below is the script I used to update the agent :

Start-Process -FilePath $scriptpath "\INAEPO01_Framepkg.exe" "/FORCEINSTALL" "/INSTALL=AGENT" -Wait

错误:

无法找到接受参数的位置参数/强制安装.

Positional parameter cannot be found that accepts argument /FORCEINSTALL.

推荐答案

试试看,即在参数之间添加逗号,使它们形成一个数组

Try it like that, i.e. add commas between the arguments so that they form an array

Start-Process -FilePath $scriptpath "\INAEPO01_Framepkg.exe","/FORCEINSTALL", "/INSTALL=AGENT" -Wait  

或者更明确

Start-Process -FilePath $scriptpath -ArgumentList "\INAEPO01_Framepkg.exe", "/FORCEINSTALL", "/INSTALL=AGENT" -Wait

这篇关于powershell脚本中的位置参数错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆