gpt4 book ai didi

powershell - 通过 Invoke-Command : "... not recognized as the name..." 调用远程 cmdlet (ffmpeg)

转载 作者:行者123 更新时间:2023-12-04 22:56:20 24 4
gpt4 key购买 nike

我正在尝试通过 Powershell 在远程转码服务器上调用 ffmpeg:

$session = new-pssession -computername transcodingserver
Invoke-Command -session $session -scriptblock { powershell ffmpeg }

ffmpeg正确安装在远程服务器上,可以在那里运行,但是远程调用会报错:
ffmpeg : The term 'ffmpeg' is not recognized as the name of a cmdlet, function, script file, or operable program.
+ CategoryInfo : NotSpecified: (ffmpeg : The te...rable program. :String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
+ PSComputerName : transcodingserver

Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ ffmpeg
+ ~~~~~~
+ CategoryInfo : ObjectNotFound: (ffmpeg:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
NotSpecified: (:) [], RemoteException

在我看来,如果机器,我运行 Invoke-Command on,尝试运行 ffmpeg,它没有安装在那里。您需要做什么才能在远程服务器上运行 ffmpeg?

最佳答案

你不需要powershell里面 -scriptblock {..}因为Invoke-Command本身就是一个 powershell session (尽管是临时的)。找到 ffmpeg 的完整路径可执行并运行以下命令

$session = new-pssession -computername transcodingserver
Invoke-Command -session $session -scriptblock { & "C:\Program Files\ffmpeg\bin\ffmpeg.exe"}

或者你可以直接执行命令,不用 new-pssession
Invoke-Command -ComputerName transcodingserver -scriptblock { 
& "C:\Program Files\ffmpeg\bin\ffmpeg.exe"}

关于powershell - 通过 Invoke-Command : "... not recognized as the name..." 调用远程 cmdlet (ffmpeg),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24083912/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com