SC 创建 binpath 错误 [英] SC create binpath error

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

问题描述

我正在尝试在 PowerShell 中运行以下命令

I am trying to run the following command in the PowerShell

sc create StrongSwan binpath= "C:\Users\Kanishk\Desktop\Strong\Strong\stronswan\strongswan-5.6.3\src\charon-svc\charon-svc.exe"

我已经检查了 .exe 的路径是否正确,我也可以 cd 到它.作为参考,我正在关注这个:https://wiki.strongswan.org/projects/strongswan/wiki/Charon-svc

I have checked the path to the .exe is correct and I can cd to it also. For reference I am following this: https://wiki.strongswan.org/projects/strongswan/wiki/Charon-svc

我收到以下错误:

Set-Content : A positional parameter cannot be found that accepts argument 'binpath='.
At line:1 char:1
+ sc create NewService binpath= C:\Users\Kanishk\Desktop\Strong\Strong\ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidArgument: (:) [Set-Content], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.SetContentCommand

所以我的问题是相同的命令在 cmd 上运行,但不在 PowerShell 上运行.有什么原因吗?

So my problem is the same command is working on cmd but not on PowerShell. Any reasons why?

推荐答案

我也遇到了这个问题.看起来错误发生在 line:1 char:1.所以我认为它不明白sc"是什么.所以我将 sc create .. 更改为 sc.exe create .. 并且它适用于我的服务.

I ran into this also. It looks like the error happens at line:1 char:1. So I assumed it doesn't understand what "sc" is. So I changed sc create .. to sc.exe create .. and it worked for my service.

这篇关于SC 创建 binpath 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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