bat file runs, but not when scheduled as a task

  • Thread starter Thread starter - Bobb -
  • Start date Start date
B

- Bobb -

XP SP2 and could use a little advice/help. Thanks.

I have an old file called DEFRAG.BAT, that simply consists of:
defrag y: -f >"d:\defragY.txt"
defrag c: -f> "d:\defragC.txt"
defrag d: -f>"c:\defragD.txt"
defrag e: -f>"d:\defragE.txt"
defrag f: -f >"d:\defragF.txt"
defrag g: -f >"d:\defragG.txt"
defrag v: -f >"d:\defragV.txt"

If I run it interactively it works fine. ( I usually start it and then run errands for the day)
If I add it to "Scheduled tasks" , it starts for a second then exits and no errorlog.
Why doesn't it complete when scheduled ? ( It starts the defragY.txt file then exits, so in the file I only get:
Windows Disk Defragmenter
Copyright (c) 2001 Microsoft Corp. and Executive Software International, Inc. )

and how to have it generate and errorlog ?
One other thing - any way to overwrite the old log file ( I usually delete them when I return from the errands)

PS When I run it manually, the defragY.txt file looks like this:
Windows Disk Defragmenter
Copyright (c) 2001 Microsoft Corp. and Executive Software International, Inc.

Analysis Report
28.32 GB Total, 17.51 GB (61%) Free, 3% Fragmented (6% file fragmentation)

Defragmentation Report
28.32 GB Total, 17.51 GB (61%) Free, 0% Fragmented (0% file fragmentation)
 
Create a new scheduled task by right click > new [not by using wizard]
Open it's properties and enter the text of the bat file each line separated with &&
Example : defrag y: -f >"d:\defragY.txt" && defrag c: -f> "d:\defragC.txt" && defrag d: -f>"c:\defragD.txt"
and schedule it as you like. See if this works.
--
Ayush [ Be ''?'' Happy ]
XP SP2 and could use a little advice/help. Thanks.

I have an old file called DEFRAG.BAT, that simply consists of:
defrag y: -f >"d:\defragY.txt"
defrag c: -f> "d:\defragC.txt"
defrag d: -f>"c:\defragD.txt"
defrag e: -f>"d:\defragE.txt"
defrag f: -f >"d:\defragF.txt"
defrag g: -f >"d:\defragG.txt"
defrag v: -f >"d:\defragV.txt"

If I run it interactively it works fine. ( I usually start it and then run errands for the day)
If I add it to "Scheduled tasks" , it starts for a second then exits and no errorlog.
Why doesn't it complete when scheduled ? ( It starts the defragY.txt file then exits, so in the file I only get:
Windows Disk Defragmenter
Copyright (c) 2001 Microsoft Corp. and Executive Software International, Inc. )

and how to have it generate and errorlog ?
One other thing - any way to overwrite the old log file ( I usually delete them when I return from the errands)

PS When I run it manually, the defragY.txt file looks like this:
Windows Disk Defragmenter
Copyright (c) 2001 Microsoft Corp. and Executive Software International, Inc.

Analysis Report
28.32 GB Total, 17.51 GB (61%) Free, 3% Fragmented (6% file fragmentation)

Defragmentation Report
28.32 GB Total, 17.51 GB (61%) Free, 0% Fragmented (0% file fragmentation)
 
I did try it and no it didn't work. I got a flash of a DOS window and no logfile at all.


"Ayush" <ayushmaan.j[aatt]gmail.com> wrote in message Create a new scheduled task by right click > new [not by using wizard]
Open it's properties and enter the text of the bat file each line separated with &&
Example : defrag y: -f >"d:\defragY.txt" && defrag c: -f> "d:\defragC.txt" && defrag d: -f>"c:\defragD.txt"
and schedule it as you like. See if this works.
--
Ayush [ Be ''?'' Happy ]
XP SP2 and could use a little advice/help. Thanks.

I have an old file called DEFRAG.BAT, that simply consists of:
defrag y: -f >"d:\defragY.txt"
defrag c: -f> "d:\defragC.txt"
defrag d: -f>"c:\defragD.txt"
defrag e: -f>"d:\defragE.txt"
defrag f: -f >"d:\defragF.txt"
defrag g: -f >"d:\defragG.txt"
defrag v: -f >"d:\defragV.txt"

If I run it interactively it works fine. ( I usually start it and then run errands for the day)
If I add it to "Scheduled tasks" , it starts for a second then exits and no errorlog.
Why doesn't it complete when scheduled ? ( It starts the defragY.txt file then exits, so in the file I only get:
Windows Disk Defragmenter
Copyright (c) 2001 Microsoft Corp. and Executive Software International, Inc. )

and how to have it generate and errorlog ?
One other thing - any way to overwrite the old log file ( I usually delete them when I return from the errands)

PS When I run it manually, the defragY.txt file looks like this:
Windows Disk Defragmenter
Copyright (c) 2001 Microsoft Corp. and Executive Software International, Inc.

Analysis Report
28.32 GB Total, 17.51 GB (61%) Free, 3% Fragmented (6% file fragmentation)

Defragmentation Report
28.32 GB Total, 17.51 GB (61%) Free, 0% Fragmented (0% file fragmentation)
 
See if this works >>
--
Ayush [ Be ''?'' Happy ]
I did try it and no it didn't work. I got a flash of a DOS window and no logfile at all.


"Ayush" <ayushmaan.j[aatt]gmail.com> wrote in message Create a new scheduled task by right click > new [not by using wizard]
Open it's properties and enter the text of the bat file each line separated with &&
Example : defrag y: -f >"d:\defragY.txt" && defrag c: -f> "d:\defragC.txt" && defrag d: -f>"c:\defragD.txt"
and schedule it as you like. See if this works.
--
Ayush [ Be ''?'' Happy ]
XP SP2 and could use a little advice/help. Thanks.

I have an old file called DEFRAG.BAT, that simply consists of:
defrag y: -f >"d:\defragY.txt"
defrag c: -f> "d:\defragC.txt"
defrag d: -f>"c:\defragD.txt"
defrag e: -f>"d:\defragE.txt"
defrag f: -f >"d:\defragF.txt"
defrag g: -f >"d:\defragG.txt"
defrag v: -f >"d:\defragV.txt"

If I run it interactively it works fine. ( I usually start it and then run errands for the day)
If I add it to "Scheduled tasks" , it starts for a second then exits and no errorlog.
Why doesn't it complete when scheduled ? ( It starts the defragY.txt file then exits, so in the file I only get:
Windows Disk Defragmenter
Copyright (c) 2001 Microsoft Corp. and Executive Software International, Inc. )

and how to have it generate and errorlog ?
One other thing - any way to overwrite the old log file ( I usually delete them when I return from the errands)

PS When I run it manually, the defragY.txt file looks like this:
Windows Disk Defragmenter
Copyright (c) 2001 Microsoft Corp. and Executive Software International, Inc.

Analysis Report
28.32 GB Total, 17.51 GB (61%) Free, 3% Fragmented (6% file fragmentation)

Defragmentation Report
28.32 GB Total, 17.51 GB (61%) Free, 0% Fragmented (0% file fragmentation)
 
Back
Top