我需要做的是在 powershell 内的远程文件共享上执行一个程序。一个示例路径是:
\mycompany\filesharename\folder\program.exe
这个程序接受一个命令行参数,一个字符串,然后解密它。问题是我需要从不同计算机上的不同文件中解密和加密数千行。通过那件事一次做一个让我发疯。我从这个开始:
clear-host
([string]$step='this')
$value = Invoke-Command '\\mycompany\fileshare\folder\software\program.exe' $step
write-host $value
这是抛出一个错误:
The term '\\mycompany\fileshare\folder\software\program.exe' is not re
cognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try
again.
At C:\Users\Me\Documents\Scripts\test.ps1:3 char:77
+ $value = \\mycompany\fileshare\folder\software\program.exe <<<< $st
ep
+ CategoryInfo : ObjectNotFound: (\\mycompany\fileshare...\program.exe:String
) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
最终计划是编写一个 gui 代码,让脚本从文件本身中获取我需要的字符串,并将它们打印到本地文件夹中。现在我需要弄清楚如何在我的脚本中使用该程序。有什么帮助吗?