[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖

[文本处理] 批处理怎样自动运行一个程序?

我在用批处理运行一个程序时,当能成功运行后,会提示:要我按Y确定


请问如何做,才能让这个动作也能自动运行????


求教各位高手。

原来有8楼这种用法,学习一下...

不知道这样可不可以,楼主改一改也许可以用得着,是用sendkey的
@echo off
start "title" cmd /c 3.bat^>out.tmp
more>vbstmp.vbs +4
for /l %%a in () do findstr /c:"Do you wish to continue? (y/n):" out.tmp&&vbstmp.vbs&&ping /n 3 localhost>nul&&type out.tmp&&pause&&exit
WScript.CreateObject("WScript.Shell").AppActivate "title"
WScript.CreateObject("WScript.Shell").SendKeys "y{enter}"

TOP

版主你好,,我已经按照你的方法去修改,,但最后输出一样需要按Y键确认。


@echo off
set VPNclient=C:\Program Files\Cisco Systems\VPN Client
echo yyyyyyyyyyyyyyyyyyyyyyyyyyyy|"%VPNclient%\vpnclient.exe" connect Singapore user username pwd password
pause

TOP

echo yyyyy|命令行程序
y的个数大于等于命令的返回行数
寒夜孤星:在没有说明的情况下,本人所有代码均运行在 XP SP3 下 (有问题请发贴,QQ临时会话已关闭)

TOP

C:\Program Files\Cisco Systems\VPN Client>vpnclient.exe /?
Cisco Systems VPN Client Version 4.6.02.0011
Copyright (C) 1998-2004 Cisco Systems, Inc. All Rights Reserved.
Client Type(s): Windows, WinNT
Running on: 5.1.2600 Service Pack 3
Config file directory: C:\Program Files\Cisco Systems\VPN Client\
You have entered an unrecognized command.
Usage:
vpnclient connect <profile> [user <username>] [eraseuserpwd | pwd <password>]
                             [nocertpwd] [cliauth] [stdin] [sd]
vpnclient disconnect
vpnclient stat [reset] [traffic] [tunnel] [route] [firewall] [repeat]
vpnclient notify
vpnclient suspendfw
vpnclient resumefw


这应该是命令程序吧???

TOP

Cisco Systems VPN Client Version 4.6.02.0011
Copyright (C) 1998-2004 Cisco Systems, Inc. All Rights Reserved.
Client Type(s): Windows, WinNT
Running on: 5.1.2600 Service Pack 3
Config file directory: C:\Program Files\Cisco Systems\VPN Client\
Initializing the VPN connection.
Initiating TCP to 155.57.155.214, port 11150
Contacting the gateway at 155.57.155.214
Authenticating user.
Negotiating security policies.
Securing communication channel.
You are attempting to enter a private computer network owned by Levi Strauss & C
o. (LS&CO.). You are authorized to enter this system only if your use is within
the scope of your work for or with LS&CO. If you are not authorized to access th
is system, you must disconnect now. All uses of or attempts to access this syste
m are subject to monitoring.  Any use of any information outside of the scope of
your work assignment from LS&CO. is expressly prohibited.
Do you wish to continue? (y/n):




echo y| 这方法,,还是不行,,请问批处理中有办法解决吗????

TOP

1:echo y|命令行程序
2:如果是非命令行程序,使用vbs模拟按键

[ 本帖最后由 hanyeguxing 于 2011-2-1 19:45 编辑 ]
寒夜孤星:在没有说明的情况下,本人所有代码均运行在 XP SP3 下 (有问题请发贴,QQ临时会话已关闭)

TOP

那是我公司的一个CISCO VPN 客户端,,当成功连接后,,会提示按Y确认。

请问如何把在批处理中自动嵌入Y的,谢谢!!!

TOP

那是我公司的一个CISCO VPN 客户端,,当成功连接后,,会提示按Y确认。

请问如何把在批处理中自动嵌入Y的,谢谢!!!

TOP

运行什么程序?
寒夜孤星:在没有说明的情况下,本人所有代码均运行在 XP SP3 下 (有问题请发贴,QQ临时会话已关闭)

TOP

返回列表