通过带有命令行参数的PSEXEC执行HTA应用程序 [英] Executing an HTA Application via PSEXEC with command line arguments

查看:172
本文介绍了通过带有命令行参数的PSEXEC执行HTA应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 .hta 应用程序,该应用程序接受两个命令行参数。通过命令行在远程计算机上执行应用程序的工作原理如下:

I have an .hta application that accepts two command line arguments. Executing the application on the remote machine via command line works just like the following

(命令行-cmd)示例:

(command line - cmd)Example:

C:\Users\<user>\Desktop>MSI-BUILDER.hta "MSI_APP" "D:\APP\15.9.98"

但是在使用台式机尝试通过PSEXEC在远程计算机上执行相同命令时,我看到应用程序正在任务中运行经理,但什么也没发生。

But when using my desktop trying to execute the same command on the remote machine via PSEXEC I see the application running in task manager but nothing happens.

第一步是将命令行参数分配给PowerShell中的变量:

The first steps were assigning the command line arguments to variables in PowerShell:

$arg1 = "MSI_APP"
$arg2 = "D:\APP\15.9.98"

并在PowerShell中执行此命令失败(没有错误,只是挂起):

and executing this command in PowerShell fails (no errors, just hangs):

.\psexec -s -i \\Srv2012 cmd /c "start /i "MSI-BUILDER" "C:\Users\<user>\Desktop\MSI-BUILDER.hta" $arg1 $arg2"

应用程序仅在任务管理器中启动,我假设在后台bu t我没有看到任何更改,因此可能只是挂起了...

The application launches just in task manager and I'm assuming in the background but I don't see any changes, so it might just be hanging...

我不确定100%是否确定我的语法适合启动HTA

Im not 100% sure if my syntax in this matter is correct for launching an HTA via powershell with command-line arguments.

还有一种方法或开关,我可以真正查看应用程序启动并在执行之后执行其操作

Also is there a way or switch that I can actually see the application launch and do its thing after remotely executing the code, for testing purposes?

推荐答案

好吧,所以终于在经过数小时尝试不同的操作之后,此命令才有效我

Okay so finally after hours of trying different things this is the command that worked for me

编辑命令:

.\PSEXEC -accepteula -s -i 2 \\SERVER cmd /c "D:\path\toapp\app.hta" $arg1 $arg2 -u username -p password

这篇关于通过带有命令行参数的PSEXEC执行HTA应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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