vbs代码问题 如何用vbs打开一个指定程序,然后在程序上输入密码?
展开全部
Option Explicit
Dim objShell, strProgram, strKeys
Set objShell = CreateObject("Wscript.Shell")
strKeys = "Hello world" '要发送的字符,请自己更改
strProgram = "c:\windows\system32\notepad.exe" '需要打开的程序,请自己指定
With objShell
.Run strProgram
WScript.Sleep 500
.SendKeys strKeys
.SendKeys "~"
End With
Set objShell = Nothing
Dim objShell, strProgram, strKeys
Set objShell = CreateObject("Wscript.Shell")
strKeys = "Hello world" '要发送的字符,请自己更改
strProgram = "c:\windows\system32\notepad.exe" '需要打开的程序,请自己指定
With objShell
.Run strProgram
WScript.Sleep 500
.SendKeys strKeys
.SendKeys "~"
End With
Set objShell = Nothing
追问
Option Explicit
Dim objShell, strProgram, strKeys
Set objShell = CreateObject("Wscript.Shell")
strKeys = "Hello world" '要发送的字符,请自己更改
strProgram = "E:\英雄联盟\TCLS\Client.exe" '需要打开的程序,请自己指定
With objShell
.Run strProgram
WScript.Sleep 3000
.SendKeys strKeys
.SendKeys "123456/.,"
End With
Set objShell = Nothing
是这样吗?
还有Enter键没加进去呢
追答
Option Explicit
Dim objShell, strProgram, strKeys
Set objShell = CreateObject("Wscript.Shell")
strProgram = "E:\英雄联盟\TCLS\Client.exe" '需要打开的程序,请自己指定
With objShell
.Run strProgram
WScript.Sleep 3000
.SendKeys "123456/.," '这里是你要输入的密码
.SendKeys "~" '这个是 Enter
End With
Set objShell = Nothing
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询