Novice Script Question


K

Keith O'Connell

Hi,

If this is the wrong group for this type of question, then just point me to
where I should be, if not, I have a question which must have been
encountered before, so if I could have a little shared wisdom....

I have created a batch file which runs perfectly if clicked direct or from a
shortcut in the start menu. I created it because I wanted to run it as a
scheduled task at 04:00hrs.

However, when I run it the scripts runs only up to the completion of the
first zip file. What is it that am I unaware of that will stop a batch file
that works perfectly in normal use from working properly in scheduled use?
The batch file is included below
--

@ECHO OFF

C:
CD "C:\Documents and Settings\Keith\My Documents\Scripts"

REM Aragorn
"C:\Program Files\WinZip\wzzip" -u -Pr -Whs -Jhrs D:Backup_Aragorn.zip
@Backup_Aragorn.txt

REM Gimli
"C:\Program Files\WinZip\wzzip" -u -Pr -Whs -Jhrs D:Backup_Gimli zip
@Backup_Gimli.txt

REM Merry
"C:\Program Files\WinZip\wzzip" -u -Pr -Whs -Jhrs D:Backup_Merry.zip
@Backup_Merry.txt

REM Pipin
"C:\Program Files\WinZip\wzzip" -u -Pr -Whs -Jhrs D:Backup_Pipin.zip
@Backup_Pipin.txt

Keith
_____

Keith O'Connell.
Maidstone, Kent. (UK)
(e-mail address removed)
 
Ad

Advertisements

A

Al Dunbar [MS-MVP]

Keith O'Connell said:
Hi,

If this is the wrong group for this type of question, then just point me to
where I should be, if not, I have a question which must have been
encountered before, so if I could have a little shared wisdom....
As good a newsgroup as any for this...
I have created a batch file which runs perfectly if clicked direct or from a
shortcut in the start menu. I created it because I wanted to run it as a
scheduled task at 04:00hrs.

However, when I run it the scripts runs only up to the completion of the
first zip file. What is it that am I unaware of that will stop a batch file
that works perfectly in normal use from working properly in scheduled use?
Hmmm, difficult to answer that question as it is difficult for us to know
know what it is that you are aware of or what it is that you are not aware
of.

Are you aware of the fact that a scheduled task does not run in the security
context of the user who created the script?

/Al
 
K

Keith O'Connell

Al,

Almost certainly I am not.

I know that I gave the Administrator ID and password to the task scheduler
in order to get it to run as far as it did, but that is the limit of my
knowledge.

Would a better question for me to ask be not ,"why does this not work" but,
"how should I be trying to do this set of tasks instead"?

Keith
 
A

Al Dunbar [MS-MVP]

Keith O'Connell said:
Al,

Almost certainly I am not.

I know that I gave the Administrator ID and password to the task scheduler
in order to get it to run as far as it did, but that is the limit of my
knowledge.
You say it ran as far as it did. How far did it run, and how do you know
this?

Did you specify to the scheduler that the task should be terminated after a
certain amount of execution time? If so, how long was this?

I do not know the command-line syntax for winzip, but assume that the .zip
files being created on the "D:" drive, in whatever happens to be the current
directory. IMHO, the current directory for a drive is not necessarily what
you might expect when a task is running.

What *is* the D: drive, anyway? If a mounted network drive, you might have
an issue.

I assume that the .txt files contain specifications of what is to be backed
up. Could it be that, in the second case, this includes something that is
inaccessible to the running task for some reason?
Would a better question for me to ask be not ,"why does this not work" but,
"how should I be trying to do this set of tasks instead"?
That depends on whether you want to understand the phenomenon or find a
perhaps completely different workaround. "Why does this not work?" is not a
bad question, assuming it is completely clear to us what it is you are
expecting it to do, and what it is that it is doing instead. It certainly
beats the question you asked, which was along the lines of: "what is it that
I am unaware of that will...".


/Al
 
M

Michael Bednarek

However, when I run it the scripts runs only up to the completion of the
first zip file. What is it that am I unaware of that will stop a batch file
that works perfectly in normal use from working properly in scheduled use?
The batch file is included below
--
(Don't use the sig separator in the middle of your message.)

[snip]
"C:\Program Files\WinZip\wzzip" -u -Pr -Whs -Jhrs D:Backup_Aragorn.zip @Backup_Aragorn.txt
[snip]

Is D: a network drive? If so, you have to ensure that the scheduled job
has it mapped.

AFAIK there is no way of telling what the "current directory" on D:
might be when the scheduled job runs; specify a fully qualified
filename.

To debug, put a PAUSE command at the end (at least), run the scheduled
job "soon", and inspect the console output.
 
K

Keith O'Connell

Al,
You say it ran as far as it did. How far did it run, and how do you know
this?
Becaust the first zip file was created, but none of the others
Did you specify to the scheduler that the task should be terminated after
a
certain amount of execution time? If so, how long was this?
No time was specified
I do not know the command-line syntax for winzip, but assume that the .zip
files being created on the "D:" drive, in whatever happens to be the
current
directory. IMHO, the current directory for a drive is not necessarily what
you might expect when a task is running.

What *is* the D: drive, anyway? If a mounted network drive, you might have
an issue.
D is a second physical hard dish in the local machine
I assume that the .txt files contain specifications of what is to be
backed
up. Could it be that, in the second case, this includes something that is
inaccessible to the running task for some reason?
It is a mirror of the txt file refered to in the first instance, but
from a different machine whose tree has been mounted as a mapped drive. I
dismissed this as a problem because the file executes to completion when
manually started.

Could it be that a local Administrator is denied access to a Users mapped
drives?

Keith.
 
Ad

Advertisements

K

Keith O'Connell

Al,
Could it be that a local Administrator is denied access to a Users mapped
drives?
That was the answer - you pointed me at it in the end. The administrator
account did not have the same network drives mapped so the script failed.
Now I understand and now I can fix it.

Thank you

Keith
 
Ad

Advertisements

A

Al Dunbar [MS-MVP]

Keith O'Connell said:
Al,


That was the answer - you pointed me at it in the end. The administrator
account did not have the same network drives mapped so the script failed.
Now I understand and now I can fix it.
Great!

Thank you
You're welcome.

/Al
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top