目前,为了改善日常处理过程中的一些低效,我正在尝试编写一个c# Winform应用程序,它将把用户输入与VBscripts相结合,从而加快以前所有用户输入的过程,即查看excel文件并将文件从VSS移动到特定服务器的特定文件夹。
我希望得到一些问题的答案,指出正确的方向:
使用命令行或其他解决方法,而不是手动
1)是否可以使用智能卡/pin登录到2003远程桌面?
2)是否可以通过您机器上的命令在远程桌面上运行文件/启动进程?
感谢您的帮助和时间
发布于 2012-06-12 00:15:13
我只有第二个问题的经验。您可以使用远程脚本或诸如SysInternals PsExec http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx之类的实用程序来完成此操作。这里是一个vbscript,它可以远程启动ipconfig命令并将其重定向到文本文件。注意,您不能像这样启动交互进程,它们将启动但不会显示
Dim sComputer 'computer name
Dim sCmdLine 'command line of the process
Dim sCurDir 'working directory of the process
Dim oProcess 'object representing the Win32_Process class
Dim oMethod 'object representing the Create method
sComputer = "." 'this is the local computer, use a pcname or ip-adress to do it remote
sCmdLine = "cmd /c ipconfig.exe > c:\ipconfig.txt"
Set oProcess = GetObject("winmgmts://" & sComputer & "/root/cimv2:Win32_Process")
Set oMethod = oProcess.Methods_("Create")
Set oInPar = oMethod.inParameters.SpawnInstance_()
oInPar.CommandLine = sCmdLine
oInPar.CurrentDirectory = sCurDir
Set oOutPar = oProcess.ExecMethod_("Create", oInPar)
If oOutPar.ReturnValue = 0 Then
WScript.Echo "Create process method completed successfully"
WScript.Echo "New Process ID is " & oOutPar.ProcessId
Else
WScript.Echo "Create process method failed"
End Ifhttps://stackoverflow.com/questions/10983062
复制相似问题