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 fluent的在模拟压强时使用希望得到一些建议
    • ¥15 STM32驱动继电器
    • ¥15 Windows server update services
    • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏
    • ¥15 模糊pid与pid仿真结果几乎一样
    • ¥15 java的GUI的运用
    • ¥15 Web.config连不上数据库
    • ¥15 我想付费需要AKM公司DSP开发资料及相关开发。
    • ¥15 怎么配置广告联盟瀑布流