ABIAMDTECH Topic Starter
Posts: 17
|
 |
« on: January 29, 2009, 12:39:06 PM » |
|
I am having problem calling a batch file inside another batch file. I have tested each of them individually and all of them works. Can someone check my codes please. Thanks.
Main batch ========== @echo off ("C:\Program Files\SI_SCOPE\si_scope32" < si_scope32 /p1:fdf0h /p2:fdf8h /i1:07 /i2:07 /BOARD_TYPE:5 /NOALERT /B:128) at 1:15PM /call "C:\Program Files\SI_SCOPE\close.bat" at 1:16PM /call "C:\Program Files\SI_SCOPE\copy.bat" at 1:17PM /call "C:\Program Files\SI_SCOPE\Hard Fault Captures\RenameFileToDate.bat" at 1:20PM /call "C:\WINDOWS\reboot.bat" ==========
Close ========== @echo off taskkill /im "si_scope32.exe" /f ==========
Copy ========== @echo off copy "C:\Program Files\SI_SCOPE\SI_SCOPE.DAT" "C:\Program Files\SI_SCOPE\Hard Fault Captures" ==========
RenameFileToDate ========== @echo off for /f "tokens=1-5 delims=/ " %%d in ("%date%") do rename "SI_SCOPE.DAT" %%e-%%f-%%g.dat ==========
Reboot ========== @echo off shutdown -r ==========
|
|
|
|
|
fireballs
Thanked: 3 Posts: 562
Code:Terminal
|
 |
« Reply #1 on: January 30, 2009, 03:41:54 AM » |
|
at 1:15PM /call "C:\Program Files\SI_SCOPE\close.bat" at 1:16PM /call "C:\Program Files\SI_SCOPE\copy.bat" at 1:17PM /call "C:\Program Files\SI_SCOPE\Hard Fault Captures\RenameFileToDate.bat" at 1:20PM /call "C:\WINDOWS\reboot.bat"
Is this literally what you've got? Unless you've got a third party app that understands this a standard DOS installation won't know what you're on about. You're best bet i reckon is to use start /wait That way it will run whatever you want to run first then the second thing after the first has finished. FB
|
Next time google it.
|
|
|
devcom
Thanked: 37 Posts: 521
|
 |
« Reply #2 on: January 30, 2009, 05:54:58 AM » |
|
@fireballs http://www.ss64.com/nt/at.html@ABIAMDTECH have you tried using just call, without '/' ?
|
|
|
|
fireballs
Thanked: 3 Posts: 562
Code:Terminal
|
 |
« Reply #3 on: January 30, 2009, 06:12:00 AM » |
|
I did wonder. Thanks Devcom.
FB
|
Next time google it.
|
|
|
ABIAMDTECH Topic Starter
Posts: 17
|
 |
« Reply #4 on: February 02, 2009, 08:35:50 AM » |
|
Hi guys, I have tried both method "start/wait" and removeing the / from call. Both method does not work. I check in the schedule task folder and it shown "could not start" in the status tab. Do you have any other methods to run these bat files?
|
|
|
|
|
devcom
Thanked: 37 Posts: 521
|
 |
« Reply #5 on: February 02, 2009, 12:59:24 PM » |
|
you can try this
@echo off :LOOP set cTime=%time:~0,-3%
if '%cTime%' equ '13:15' call "C:\Program Files\SI_SCOPE\close.bat" if '%cTime%' equ '13:16' call "C:\Program Files\SI_SCOPE\copy.bat" if '%cTime%' equ '13:17' call "C:\Program Files\SI_SCOPE\Hard Fault Captures\RenameFileToDate.bat" if '%cTime%' equ '13:20' call "C:\WINDOWS\reboot.bat"
goto LOOP but this code must run all time in background
|
|
|
|
ABIAMDTECH Topic Starter
Posts: 17
|
 |
« Reply #6 on: February 02, 2009, 01:47:23 PM » |
|
devcom, I am not sure what is the problem, but your code does not work too. When I tried setting up schedule task, it said that there is some problem in the "account" and my not start the task correctly. By "account" does it mean the directory?
|
|
|
|
|
devcom
Thanked: 37 Posts: 521
|
 |
« Reply #7 on: February 02, 2009, 02:14:51 PM » |
|
maybe you are not logged as admin ? and what is not working in my code ?
|
|
|
|
|
|
ABIAMDTECH Topic Starter
Posts: 17
|
 |
« Reply #9 on: February 02, 2009, 05:50:22 PM » |
|
@devcom, yes, I logged in as admin. I am not sure what is not working in the code, but I do know that it is not running those batch files. I will make the batch file part of "start up" instead of schedule task tomorrow and see if it does it differently. Thanks
@Greek-9pm, SI_SCOPE is the directory/application I want to run my batch files.
|
|
|
|
|
|
|
ABIAMDTECH Topic Starter
Posts: 17
|
 |
« Reply #11 on: February 02, 2009, 07:40:23 PM » |
|
Thanks Geek-9pm, I will try that out tomorrow.
|
|
|
|
|
ABIAMDTECH Topic Starter
Posts: 17
|
 |
« Reply #12 on: February 03, 2009, 09:13:29 AM » |
|
Hi guys, I have tried the two codes together. It runs a continuous loop. But that is all. When it reaches the set time, nothing happen. It does not execute any of the batch file. ========================== C: CD \Program Files\SI_SCOPE\ :LOOP set cTime=%time:~0,-3%
if '%cTime%' equ '10:06' call Copy.bat if '%cTime%' equ '10:07' call \Hard Fault Captures\RenameFileToDate.bat if '%cTime%' equ '10:08' call C:\WINDOWS\reboot.bat
goto LOOP ==========================
|
|
|
|
|
TheShredder
Posts: 5
|
 |
« Reply #13 on: February 03, 2009, 12:56:27 PM » |
|
if '%cTime%' equ '10:06' call Copy.bat if '%cTime%' equ '10:07' call \Hard Fault Captures\RenameFileToDate.bat if '%cTime%' equ '10:08' call C:\WINDOWS\reboot.bat ==========================
equ?  i've not yet tried to do anything with time in my programs, but i've used the IF statement quite a bit and i've always used == there. perhaps trying it like if %cTime% == "10:06" call Copy.bat if %cTime% == "10:07" call \Hard Fault Captures\RenameFileToDate.bat if %cTime% == "10:08" call C:\WINDOWS\reboot.bat
|
no, i don't shred, but my shredder can overwrite any number of files 9 times (more then the russian goverment) before deletion. oh, and it does it in 4 seconds. (tested up to 11,000 files at once.) -pm me for details or if you' like a free download)
|
|
|
devcom
Thanked: 37 Posts: 521
|
 |
« Reply #14 on: February 04, 2009, 12:51:13 PM » |
|
CD \Program Files\SI_SCOPE\ set cTime=%time:~0,-3%
if '%cTime%' equ '10:06' call Copy.bat if '%cTime%' equ '10:07' call \Hard Fault Captures\RenameFileToDate.bat if '%cTime%' equ '10:08' call C:\WINDOWS\reboot.bat
pausetry this code and copy here all text that apear in console box
|
|
|
|