简体   繁体   English

如何在远程Windows机器上打开文件并查看

[英]How to open a file and view on remote windows machine

I want to open a file on remote windows machine from my local windows machine. 我想从本地Windows机器上打开远程Windows机器上的文件。 The file should be visible on remote machine only. 该文件应仅在远程计算机上可见。

My problem is, I should open a bat file on remote pc which creates access to do something like opening browser etc. 我的问题是,我应该在远程PC上打开一个bat文件,该文件可以创建访问权限,例如打开浏览器等。

I did using PSExec to run the bat file remotely. 我确实使用PSExec来远程运行bat文件。 Everything looked good, but when i try to open the browser on remote pc, it does not open browser but shows browser processes in task manager. 一切看起来都不错,但是当我尝试在远程PC上打开浏览器时,它没有打开浏览器,而是在任务管理器中显示了浏览器进程。

When I go and open that bat file manually on remote machine everything works fine. 当我去手动在远程计算机上打开该bat文件时,一切正常。 Browser opens and my work is done. 浏览器打开,我的工作完成。

But I want to do that from my local machine especially from the command line. 但是我想在本地计算机上执行此操作,尤其是在命令行上。 So that I can use this commands in Java. 这样我就可以在Java中使用此命令。

Please help. 请帮忙。 If question is not clear please ask for more info. 如果问题不清楚,请询问更多信息。

Try using the -i option with psexec or specifying a session ie. 尝试将-i选项与psexec一起使用或指定会话,即。 -i 1 -i 1

From the psexec manual. 来自psexec手册。

'-i Run the program so that it interacts with the desktop of the specified session on the remote system. '-i运行程序,使其与远程系统上指定会话的桌面进行交互。 If no session is specified the process runs in the console session.' 如果未指定会话,则该过程在控制台会话中运行。

example: 例:

C:\\SysinternalsSuite\\psexec.exe \\remotecomputer -u DOMAIN\\administrator -p adminpass -i 1 "\\remotecomputer\\c$\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe" http://tinyurl.com/6fbgntx C:\\ SysinternalsSuite \\ psexec.exe \\ remotecomputer -u DOMAIN \\ administrator -p adminpass -i 1“ \\ remotecomputer \\ c $ \\ Program Files(x86)\\ Google \\ Chrome \\ Application \\ chrome.exe” http:// tinyurl。 com / 6fbgntx

I'd suggest you to use WMI - It management instrumentation. 我建议您使用WMI-It管理工具。 It allows running process on remote machine (obviously if you have enough permissions). 它允许在远程计算机上运行进程(显然,如果您具有足够的权限)。 You can either access WMI from Java using one of popular interoparability libraries (JaWin, JInterop, JIntegra) or write JScript or VBScript and execute it from java. 您可以使用流行的互操作性库之一(JaWin,JInterop,JIntegra)从Java访问WMI,也可以编写JScript或VBScript并从Java执行它。

JaWin and Jinterop are open-source. JaWin和Jinterop是开源的。 JIntegra is not. JIntegra不是。 JaWin requires windows OS on client machine. JaWin需要在客户端计算机上使用Windows OS。 JIntegra and JInterop can be executed from other OS. 可以从其他OS执行JIntegra和JInterop。

I used all 2 suggested methods and all 3 libraries. 我使用了所有2个建议的方法和所有3个库。 Probably now I prefer JInterop. 现在可能我更喜欢JInterop。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM