dongye9453 2019-05-21 14:19
浏览 62

使用VBS的BAT不会从WTS运行

I need to run a .bat file from Windows Task Scheduler WTS. If I run the .bat with double click it works. But it isn't working when launching from WTS.

On WTS my action is:

C:\path\file.bat

The file.bat opens file2.php, which opens file3.vbs.

I have this working on other files, also from WTS.

Originaly file.bat runs directly vbs file without php but it also doesnt work on WTS. Running each appart works fine, but none works from WTS.

file.bat

c:\wamp64\bin\php\php7.2.10\php.exe -f "C:\wamp64\www\backups\web\file2.php"

file2.php

$comando = "C:\\WINDOWS\\SysWOW64\\wscript.exe C:\\wamp64\\www\\backups\\web\\file3.vbs";
shell_exec($comando); 

file3.vbs

Dim WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")
Dim exeName
Dim fileName

exeName = """%programfiles%\Notepad++
otepad++.exe"""

fileName1 = """C:\wamp64\www\file4.php"""
Call WshShell.Run(fileName1)
WScript.Sleep 2000
WshShell.SendKeys("^+B")    ' "^+9" is Ctrl+Shift+9. Replace it with your preferred shortcut. 
WScript.Sleep 2000

I am not getting any kind of error on WTS, it just run for a few seconds and ends. I need it to run even if I am not logged in. The reason why I am using secuence bat-php-vbs-php is because I need other things to be done. The full scripts have more than just this, but just like this they are not working.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 微信会员卡接入微信支付商户号收款
    • ¥15 如何获取烟草零售终端数据
    • ¥15 数学建模招标中位数问题
    • ¥15 phython路径名过长报错 不知道什么问题
    • ¥15 深度学习中模型转换该怎么实现
    • ¥15 HLs设计手写数字识别程序编译通不过
    • ¥15 Stata外部命令安装问题求帮助!
    • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
    • ¥15 TYPCE母转母,插入认方向
    • ¥15 如何用python向钉钉机器人发送可以放大的图片?