สำหรับนักพัฒนาจากประสบการณ์ที่ได้พบเจอมาคือได้พัฒนาโปรแกรมมาตัวหนึ่งจากนั้นสั่งให้โปรแกรมรันทำงานทุกนาทีโดยสั่งจาก
task schedule โดยให้ไปรันไฟล์
.bat แล้วในไฟล์จะเป็นคำสั่ง
command ที่จะไปรันตัวโปรแกรมอีกที ปัญหาคือขณะที่ถึงเวลาทำงานจะมีหน้าต่าง console ของ
command prompt เด้งขึ้นมาทุกๆนาที ส่งผลขณะที่ใช้งานเครื่องไปพร้อมกัน จึงมีใช้การแก้ไขปัญหาดังกล่าว
วิธีการให้ทำการเขียนคำสั่ง
VB มาอ่านไฟล์ .bat
1.ทำการสร้างไฟล์ VB เพื่อเขียน script เพื่อไปอ่านไฟล .bat
- Python Knowledge-1.png (60.21 KiB) Viewed 4048 times
runhidden.vbs
โค้ด: เลือกทั้งหมด
Set oShell = CreateObject ("Wscript.Shell")
Dim strCMD
strCMD = "cmd cd /c C:\xmlrpc_scanfinger\runauto.bat"
oShell.Run strCMD, 0, false
ควรตรวจสอบ path ที่อยู่ของโปรแกรมให้ดีๆ
2.ให้ไปเปลี่ยน action ใน task schedule จากเดิมที่รัน ไฟล์ .bat มารันไฟล์ VB แทน
- Python Knowledge-1.png (37.18 KiB) Viewed 4048 times
อ้างอิง
https://superuser.com/questions/478052/windows-7-task-scheduler-hidden-setting-doesnt-work
https://serverfault.com/questions/9038/run-a-bat-file-in-a-scheduled-task-without-a-window/9042
https://www.robvanderwoude.com/battech_hideconsole.php
สำหรับนักพัฒนาจากประสบการณ์ที่ได้พบเจอมาคือได้พัฒนาโปรแกรมมาตัวหนึ่งจากนั้นสั่งให้โปรแกรมรันทำงานทุกนาทีโดยสั่งจาก [url=https://www.mindphp.com/developer/tips-python/7735-task-scheduler-auto.html]task schedule[/url] โดยให้ไปรันไฟล์ [url=https://mindphp.com/forums/viewtopic.php?f=79&t=39086].bat[/url] แล้วในไฟล์จะเป็นคำสั่ง [url=https://www.mindphp.com/%E0%B8%9A%E0%B8%97%E0%B8%84%E0%B8%A7%E0%B8%B2%E0%B8%A1/66-server-hosting/4396-command-line-command-in-ubuntu.html]command[/url] ที่จะไปรันตัวโปรแกรมอีกที ปัญหาคือขณะที่ถึงเวลาทำงานจะมีหน้าต่าง console ของ [url=https://www.mindphp.com/%E0%B8%84%E0%B8%B9%E0%B9%88%E0%B8%A1%E0%B8%B7%E0%B8%AD/73-%E0%B8%84%E0%B8%B7%E0%B8%AD%E0%B8%AD%E0%B8%B0%E0%B9%84%E0%B8%A3/2434-cmd.html]command prompt[/url] เด้งขึ้นมาทุกๆนาที ส่งผลขณะที่ใช้งานเครื่องไปพร้อมกัน จึงมีใช้การแก้ไขปัญหาดังกล่าว
วิธีการให้ทำการเขียนคำสั่ง [url=https://www.mindphp.com/%E0%B8%84%E0%B8%B9%E0%B9%88%E0%B8%A1%E0%B8%B7%E0%B8%AD/73-%E0%B8%84%E0%B8%B7%E0%B8%AD%E0%B8%AD%E0%B8%B0%E0%B9%84%E0%B8%A3/3637-visual-basic-net-%E0%B8%A7%E0%B8%B4%E0%B8%8A%E0%B8%A7%E0%B8%A5%E0%B9%80%E0%B8%9A%E0%B8%AA%E0%B8%B4%E0%B8%81%E0%B8%94%E0%B8%AD%E0%B8%97%E0%B9%80%E0%B8%99%E0%B9%87%E0%B8%95-%E0%B8%84%E0%B8%B7%E0%B8%AD%E0%B8%AD%E0%B8%B0%E0%B9%84%E0%B8%A3.html]VB[/url] มาอ่านไฟล์ .bat
1.ทำการสร้างไฟล์ VB เพื่อเขียน script เพื่อไปอ่านไฟล .bat
[attachment=1]Python Knowledge-1.png[/attachment]
runhidden.vbs
[code]
Set oShell = CreateObject ("Wscript.Shell")
Dim strCMD
strCMD = "cmd cd /c C:\xmlrpc_scanfinger\runauto.bat"
oShell.Run strCMD, 0, false
[/code]
ควรตรวจสอบ path ที่อยู่ของโปรแกรมให้ดีๆ
2.ให้ไปเปลี่ยน action ใน task schedule จากเดิมที่รัน ไฟล์ .bat มารันไฟล์ VB แทน
[attachment=0]Python Knowledge-1.png[/attachment]
[b]อ้างอิง[/b]
https://superuser.com/questions/478052/windows-7-task-scheduler-hidden-setting-doesnt-work
https://serverfault.com/questions/9038/run-a-bat-file-in-a-scheduled-task-without-a-window/9042
https://www.robvanderwoude.com/battech_hideconsole.php