MS Scheduled Task

  • Thread starter Thread starter Wojo
  • Start date Start date
W

Wojo

I'm having a problem with MS Scheduled Task. I'm trying to run a
simple batch file via the scheduler but the DOS (Command Line) window
opens then quickly closes without running the bat file. When I run the
batch file manually it runs successfully. The batch file is a simple
copy command and it is set up as follows:

copy \\chicago\murexmxgro\xfer\MurexGFX_UserAccess.txt
"\\newyork\ds_dfs\GCIB Admin\TSISAuditExtracts\MurexGFX"

I have the following set up in the Run field found in the Scheduled
Task:

"P:\Tech&Ops\Scheduled Tasks\Report Output\MurexGFX.bat"

Not sure what I'm missing?
 
Insert a PAUSE command before and after your command and see what error
message you are getting. The content of your batch file will look like:

REM. BEGINING OF BATCH!
ECHO ON
PAUSE
copy \\chicago\murexmxgro\xfer\MurexGFX_UserAccess.txt
"\\newyork\ds_dfs\GCIB Admin\TSISAuditExtracts\MurexGFX"
PAUSE
REM. END OF BATCH!

And run the task through your task manager. Read the result and try to solve
the problem. Let us know what happend.

Good luck
Mo
 
Wojo said:
I'm having a problem with MS Scheduled Task. I'm trying to run a
simple batch file via the scheduler but the DOS (Command Line) window
opens then quickly closes without running the bat file. When I run the
batch file manually it runs successfully. The batch file is a simple
copy command and it is set up as follows:

copy \\chicago\murexmxgro\xfer\MurexGFX_UserAccess.txt
"\\newyork\ds_dfs\GCIB Admin\TSISAuditExtracts\MurexGFX"

I have the following set up in the Run field found in the Scheduled
Task:

"P:\Tech&Ops\Scheduled Tasks\Report Output\MurexGFX.bat"

Not sure what I'm missing?

An often used alternative to inserting "pause" statements is to run
the the batch file from a Command Prompt:
- Click Start / Run / cmd
- Type "P:\Tech&Ops\Scheduled Tasks\Report Output\MurexGFX.bat"

Note that mapped drives are often either visible under scheduled tasks
or are inaccessible because of permission issues.
 
MPourag,
That works fine when I run it manually but when I try it via the
scheduler I get the
same result. The Command Prompt window opens but then closes quickly
without
running the bat file.
 
Pegasus,

I received the same result as before. When I run it manually it works
fine, however,
when I run it via the scheduler the Command Prompt window opens then
closes before
running the bat file. I did include the server name in the Run field
this time around as follows but still no luck:

"\\chicago\doblib\Tech&Ops\Scheduled Tasks\Report Output\MurexGFX.bat"
 
Time to get serious. Modify your batch file like so:
@echo off
echo %date% %time% Start of task > c:\test.log
echo User=%UserName%, Path=%path% >> c:\test.log
[put your own lines of code here]
echo %date% %time% End of task >> c:\test.log

Now do this:
1. Run the job manually.
2. Examine c:\test.log.
3. Schedule the job.
4. Examine c:\test.log.
5. Post your version of the batch file here.
6. Post the contents of c:\test.log here.
 
Pegasus,

Here's my version of the bat file:

@echo off
echo %date% %time% Start of task > c:\test.log
echo User=%UserName%, Path=%path% >> c:\test.log

copy \\chiprddat\murexmxgro\xfer\MurexGFX_UserAccess.txt
"\\crprdndfs01\ds_dfs\GCIB Admin\TSISAuditExtracts\ADV"

copy \\chiprddat\murexmxgro\xfer\MurexGFX_GroupDesc.txt
"\\crprdndfs01\ds_dfs\GCIB Admin\TSISAuditExtracts\ADV"

echo %date% %time% End of task >> c:\test.log

A test.log does not get created when I run it via the scheduler. Here
are the contents of the log file when I run it manually:

Thu 11/30/2006 16:38:44.58 Start of task
User=nbkr9hh,
Path=C:\WINNT\System32;\\neon\binlib\dll\sql11.1.1\bin;\\neon\binlib\dll\sql11.1.1\dll;;C:\WINNT;C:\WINNT\System32;\\radon\binlib\dll\sql12\OCS-12_0\dll;\\radon\binlib\dll\sql12\OCS-12_0\bin;C:\WINNT\System32\Wbem;C:\Program
Files\Microsoft SQL Server\80\Tools\BINN;c:\lim\vbapi;c:\Program
Files\Rational\Common\;c:\Program Files\Common Files\Crystal
Decisions\2.5\bin\
Thu 11/30/2006 16:38:44.70 End of task
Time to get serious. Modify your batch file like so:
@echo off
echo %date% %time% Start of task > c:\test.log
echo User=%UserName%, Path=%path% >> c:\test.log
[put your own lines of code here]
echo %date% %time% End of task >> c:\test.log

Now do this:
1. Run the job manually.
2. Examine c:\test.log.
3. Schedule the job.
4. Examine c:\test.log.
5. Post your version of the batch file here.
6. Post the contents of c:\test.log here.


Wojo said:
Pegasus,

I received the same result as before. When I run it manually it works
fine, however,
when I run it via the scheduler the Command Prompt window opens then
closes before
running the bat file. I did include the server name in the Run field
this time around as follows but still no luck:

"\\chicago\doblib\Tech&Ops\Scheduled Tasks\Report Output\MurexGFX.bat"
 
The log file clearly proves that the batch file runs, even though
you originally thought that it did not do anything. You now
have to find out why it does not do what it's supposed to do.
I suspect that user nbkr9hh does not have adequate access
rights to the target folder. Here is you it's done:

@echo off
echo %date% %time% Start of task > c:\test.log
echo User=%UserName% >> c:\test.log

copy \\chiprddat\murexmxgro\xfer\MurexGFX_UserAccess.txt
"\\crprdndfs01\ds_dfs\GCIB Admin\TSISAuditExtracts\ADV" 1>>c:\test.log 2>>&1

copy \\chiprddat\murexmxgro\xfer\MurexGFX_GroupDesc.txt
"\\crprdndfs01\ds_dfs\GCIB Admin\TSISAuditExtracts\ADV" 1>>c:\test.log 2>>&1

echo %date% %time% End of task >> c:\test.log



Wojo said:
Pegasus,

Here's my version of the bat file:

@echo off
echo %date% %time% Start of task > c:\test.log
echo User=%UserName%, Path=%path% >> c:\test.log

copy \\chiprddat\murexmxgro\xfer\MurexGFX_UserAccess.txt
"\\crprdndfs01\ds_dfs\GCIB Admin\TSISAuditExtracts\ADV"

copy \\chiprddat\murexmxgro\xfer\MurexGFX_GroupDesc.txt
"\\crprdndfs01\ds_dfs\GCIB Admin\TSISAuditExtracts\ADV"

echo %date% %time% End of task >> c:\test.log

A test.log does not get created when I run it via the scheduler. Here
are the contents of the log file when I run it manually:

Thu 11/30/2006 16:38:44.58 Start of task
User=nbkr9hh,
Path=C:\WINNT\System32;\\neon\binlib\dll\sql11.1.1\bin;\\neon\binlib\dll\sql
11.1.1\dll;;C:\WINNT;C:\WINNT\System32;\\radon\binlib\dll\sql12\OCS-12_0\dll
;\\radon\binlib\dll\sql12\OCS-12_0\bin;C:\WINNT\System32\Wbem;C:\Program
Files\Microsoft SQL Server\80\Tools\BINN;c:\lim\vbapi;c:\Program
Files\Rational\Common\;c:\Program Files\Common Files\Crystal
Decisions\2.5\bin\
Thu 11/30/2006 16:38:44.70 End of task
Time to get serious. Modify your batch file like so:
@echo off
echo %date% %time% Start of task > c:\test.log
echo User=%UserName%, Path=%path% >> c:\test.log
[put your own lines of code here]
echo %date% %time% End of task >> c:\test.log

Now do this:
1. Run the job manually.
2. Examine c:\test.log.
3. Schedule the job.
4. Examine c:\test.log.
5. Post your version of the batch file here.
6. Post the contents of c:\test.log here.


Wojo said:
Pegasus,

I received the same result as before. When I run it manually it works
fine, however,
when I run it via the scheduler the Command Prompt window opens then
closes before
running the bat file. I did include the server name in the Run field
this time around as follows but still no luck:

"\\chicago\doblib\Tech&Ops\Scheduled Tasks\Report Output\MurexGFX.bat"

Pegasus (MVP) wrote:
I'm having a problem with MS Scheduled Task. I'm trying to run a
simple batch file via the scheduler but the DOS (Command Line) window
opens then quickly closes without running the bat file. When I run the
batch file manually it runs successfully. The batch file is a simple
copy command and it is set up as follows:

copy \\chicago\murexmxgro\xfer\MurexGFX_UserAccess.txt
"\\newyork\ds_dfs\GCIB Admin\TSISAuditExtracts\MurexGFX"

I have the following set up in the Run field found in the Scheduled
Task:

"P:\Tech&Ops\Scheduled Tasks\Report Output\MurexGFX.bat"

Not sure what I'm missing?


An often used alternative to inserting "pause" statements is to run
the the batch file from a Command Prompt:
- Click Start / Run / cmd
- Type "P:\Tech&Ops\Scheduled Tasks\Report Output\MurexGFX.bat"

Note that mapped drives are often either visible under scheduled tasks
or are inaccessible because of permission issues.
 
Pegasus,

I do get the following test.log after moving the bat file to my C
drive. As I mentioned earlier a test.log
is not created when the bat file is located on the network:

Thu 11/30/2006 17:11:24.58 Start of task
User=nbkr9hh,
Path=\\neon\binlib\dll\sql11.1.1\bin;\\neon\binlib\dll\sql11.1.1\dll;;C:\WINNT;C:\WINNT\System32;\\radon\binlib\dll\sql12\OCS-12_0\dll;\\radon\binlib\dll\sql12\OCS-12_0\bin;C:\WINNT\System32\Wbem;C:\Program
Files\Microsoft SQL Server\80\Tools\BINN;c:\lim\vbapi;c:\Program
Files\Rational\Common\;c:\Program Files\Common Files\Crystal
Decisions\2.5\bin\
Thu 11/30/2006 17:11:24.72 End of task

Pegasus,

Here's my version of the bat file:

@echo off
echo %date% %time% Start of task > c:\test.log
echo User=%UserName%, Path=%path% >> c:\test.log

copy \\chiprddat\murexmxgro\xfer\MurexGFX_UserAccess.txt
"\\crprdndfs01\ds_dfs\GCIB Admin\TSISAuditExtracts\ADV"

copy \\chiprddat\murexmxgro\xfer\MurexGFX_GroupDesc.txt
"\\crprdndfs01\ds_dfs\GCIB Admin\TSISAuditExtracts\ADV"

echo %date% %time% End of task >> c:\test.log

A test.log does not get created when I run it via the scheduler. Here
are the contents of the log file when I run it manually:

Thu 11/30/2006 16:38:44.58 Start of task
User=nbkr9hh,
Path=C:\WINNT\System32;\\neon\binlib\dll\sql11.1.1\bin;\\neon\binlib\dll\sql11.1.1\dll;;C:\WINNT;C:\WINNT\System32;\\radon\binlib\dll\sql12\OCS-12_0\dll;\\radon\binlib\dll\sql12\OCS-12_0\bin;C:\WINNT\System32\Wbem;C:\Program
Files\Microsoft SQL Server\80\Tools\BINN;c:\lim\vbapi;c:\Program
Files\Rational\Common\;c:\Program Files\Common Files\Crystal
Decisions\2.5\bin\
Thu 11/30/2006 16:38:44.70 End of task
Time to get serious. Modify your batch file like so:
@echo off
echo %date% %time% Start of task > c:\test.log
echo User=%UserName%, Path=%path% >> c:\test.log
[put your own lines of code here]
echo %date% %time% End of task >> c:\test.log

Now do this:
1. Run the job manually.
2. Examine c:\test.log.
3. Schedule the job.
4. Examine c:\test.log.
5. Post your version of the batch file here.
6. Post the contents of c:\test.log here.


Wojo said:
Pegasus,

I received the same result as before. When I run it manually it works
fine, however,
when I run it via the scheduler the Command Prompt window opens then
closes before
running the bat file. I did include the server name in the Run field
this time around as follows but still no luck:

"\\chicago\doblib\Tech&Ops\Scheduled Tasks\Report Output\MurexGFX.bat"

Pegasus (MVP) wrote:
I'm having a problem with MS Scheduled Task. I'm trying to run a
simple batch file via the scheduler but the DOS (Command Line) window
opens then quickly closes without running the bat file. When I run the
batch file manually it runs successfully. The batch file is a simple
copy command and it is set up as follows:

copy \\chicago\murexmxgro\xfer\MurexGFX_UserAccess.txt
"\\newyork\ds_dfs\GCIB Admin\TSISAuditExtracts\MurexGFX"

I have the following set up in the Run field found in the Scheduled
Task:

"P:\Tech&Ops\Scheduled Tasks\Report Output\MurexGFX.bat"

Not sure what I'm missing?


An often used alternative to inserting "pause" statements is to run
the the batch file from a Command Prompt:
- Click Start / Run / cmd
- Type "P:\Tech&Ops\Scheduled Tasks\Report Output\MurexGFX.bat"

Note that mapped drives are often either visible under scheduled tasks
or are inaccessible because of permission issues.
 
Locating the batch file on the network is not a good
idea - the task might not be able to access it because
of insufficient access rights.


Wojo said:
Pegasus,

I do get the following test.log after moving the bat file to my C
drive. As I mentioned earlier a test.log
is not created when the bat file is located on the network:

Thu 11/30/2006 17:11:24.58 Start of task
User=nbkr9hh,
Path=\\neon\binlib\dll\sql11.1.1\bin;\\neon\binlib\dll\sql11.1.1\dll;;C:\WIN
NT;C:\WINNT\System32;\\radon\binlib\dll\sql12\OCS-12_0\dll;\\radon\binlib\dl
l\sql12\OCS-12_0\bin;C:\WINNT\System32\Wbem;C:\Program
Files\Microsoft SQL Server\80\Tools\BINN;c:\lim\vbapi;c:\Program
Files\Rational\Common\;c:\Program Files\Common Files\Crystal
Decisions\2.5\bin\
Thu 11/30/2006 17:11:24.72 End of task

Pegasus,

Here's my version of the bat file:

@echo off
echo %date% %time% Start of task > c:\test.log
echo User=%UserName%, Path=%path% >> c:\test.log

copy \\chiprddat\murexmxgro\xfer\MurexGFX_UserAccess.txt
"\\crprdndfs01\ds_dfs\GCIB Admin\TSISAuditExtracts\ADV"

copy \\chiprddat\murexmxgro\xfer\MurexGFX_GroupDesc.txt
"\\crprdndfs01\ds_dfs\GCIB Admin\TSISAuditExtracts\ADV"

echo %date% %time% End of task >> c:\test.log

A test.log does not get created when I run it via the scheduler. Here
are the contents of the log file when I run it manually:

Thu 11/30/2006 16:38:44.58 Start of task
User=nbkr9hh,
Path=C:\WINNT\System32;\\neon\binlib\dll\sql11.1.1\bin;\\neon\binlib\dll\sql
11.1.1\dll;;C:\WINNT;C:\WINNT\System32;\\radon\binlib\dll\sql12\OCS-12_0\dll
;\\radon\binlib\dll\sql12\OCS-12_0\bin;C:\WINNT\System32\Wbem;C:\Program
Files\Microsoft SQL Server\80\Tools\BINN;c:\lim\vbapi;c:\Program
Files\Rational\Common\;c:\Program Files\Common Files\Crystal
Decisions\2.5\bin\
Thu 11/30/2006 16:38:44.70 End of task
Time to get serious. Modify your batch file like so:
@echo off
echo %date% %time% Start of task > c:\test.log
echo User=%UserName%, Path=%path% >> c:\test.log
[put your own lines of code here]
echo %date% %time% End of task >> c:\test.log

Now do this:
1. Run the job manually.
2. Examine c:\test.log.
3. Schedule the job.
4. Examine c:\test.log.
5. Post your version of the batch file here.
6. Post the contents of c:\test.log here.


Pegasus,

I received the same result as before. When I run it manually it works
fine, however,
when I run it via the scheduler the Command Prompt window opens then
closes before
running the bat file. I did include the server name in the Run field
this time around as follows but still no luck:

"\\chicago\doblib\Tech&Ops\Scheduled Tasks\Report Output\MurexGFX.bat"

Pegasus (MVP) wrote:
I'm having a problem with MS Scheduled Task. I'm trying to run a
simple batch file via the scheduler but the DOS (Command Line) window
opens then quickly closes without running the bat file. When I run the
batch file manually it runs successfully. The batch file is a simple
copy command and it is set up as follows:

copy \\chicago\murexmxgro\xfer\MurexGFX_UserAccess.txt
"\\newyork\ds_dfs\GCIB Admin\TSISAuditExtracts\MurexGFX"

I have the following set up in the Run field found in the Scheduled
Task:

"P:\Tech&Ops\Scheduled Tasks\Report Output\MurexGFX.bat"

Not sure what I'm missing?


An often used alternative to inserting "pause" statements is to run
the the batch file from a Command Prompt:
- Click Start / Run / cmd
- Type "P:\Tech&Ops\Scheduled Tasks\Report Output\MurexGFX.bat"

Note that mapped drives are often either visible under scheduled tasks
or are inaccessible because of permission issues.
 
Pegasus,

You rock! It worked by locating the batch file on my C drive.

Thanks
Locating the batch file on the network is not a good
idea - the task might not be able to access it because
of insufficient access rights.


Wojo said:
Pegasus,

I do get the following test.log after moving the bat file to my C
drive. As I mentioned earlier a test.log
is not created when the bat file is located on the network:

Thu 11/30/2006 17:11:24.58 Start of task
User=nbkr9hh,
Path=\\neon\binlib\dll\sql11.1.1\bin;\\neon\binlib\dll\sql11.1.1\dll;;C:\WIN
NT;C:\WINNT\System32;\\radon\binlib\dll\sql12\OCS-12_0\dll;\\radon\binlib\dl
l\sql12\OCS-12_0\bin;C:\WINNT\System32\Wbem;C:\Program
Files\Microsoft SQL Server\80\Tools\BINN;c:\lim\vbapi;c:\Program
Files\Rational\Common\;c:\Program Files\Common Files\Crystal
Decisions\2.5\bin\
Thu 11/30/2006 17:11:24.72 End of task

Pegasus,

Here's my version of the bat file:

@echo off
echo %date% %time% Start of task > c:\test.log
echo User=%UserName%, Path=%path% >> c:\test.log

copy \\chiprddat\murexmxgro\xfer\MurexGFX_UserAccess.txt
"\\crprdndfs01\ds_dfs\GCIB Admin\TSISAuditExtracts\ADV"

copy \\chiprddat\murexmxgro\xfer\MurexGFX_GroupDesc.txt
"\\crprdndfs01\ds_dfs\GCIB Admin\TSISAuditExtracts\ADV"

echo %date% %time% End of task >> c:\test.log

A test.log does not get created when I run it via the scheduler. Here
are the contents of the log file when I run it manually:

Thu 11/30/2006 16:38:44.58 Start of task
User=nbkr9hh,
Path=C:\WINNT\System32;\\neon\binlib\dll\sql11.1.1\bin;\\neon\binlib\dll\sql
11.1.1\dll;;C:\WINNT;C:\WINNT\System32;\\radon\binlib\dll\sql12\OCS-12_0\dll
;\\radon\binlib\dll\sql12\OCS-12_0\bin;C:\WINNT\System32\Wbem;C:\Program
Files\Microsoft SQL Server\80\Tools\BINN;c:\lim\vbapi;c:\Program
Files\Rational\Common\;c:\Program Files\Common Files\Crystal
Decisions\2.5\bin\
Thu 11/30/2006 16:38:44.70 End of task

Pegasus (MVP) wrote:
Time to get serious. Modify your batch file like so:
@echo off
echo %date% %time% Start of task > c:\test.log
echo User=%UserName%, Path=%path% >> c:\test.log
[put your own lines of code here]
echo %date% %time% End of task >> c:\test.log

Now do this:
1. Run the job manually.
2. Examine c:\test.log.
3. Schedule the job.
4. Examine c:\test.log.
5. Post your version of the batch file here.
6. Post the contents of c:\test.log here.


Pegasus,

I received the same result as before. When I run it manually it works
fine, however,
when I run it via the scheduler the Command Prompt window opens then
closes before
running the bat file. I did include the server name in the Run field
this time around as follows but still no luck:

"\\chicago\doblib\Tech&Ops\Scheduled Tasks\Report Output\MurexGFX.bat"

Pegasus (MVP) wrote:
I'm having a problem with MS Scheduled Task. I'm trying to run a
simple batch file via the scheduler but the DOS (Command Line) window
opens then quickly closes without running the bat file. When I run the
batch file manually it runs successfully. The batch file is a simple
copy command and it is set up as follows:

copy \\chicago\murexmxgro\xfer\MurexGFX_UserAccess.txt
"\\newyork\ds_dfs\GCIB Admin\TSISAuditExtracts\MurexGFX"

I have the following set up in the Run field found in the Scheduled
Task:

"P:\Tech&Ops\Scheduled Tasks\Report Output\MurexGFX.bat"

Not sure what I'm missing?


An often used alternative to inserting "pause" statements is to run
the the batch file from a Command Prompt:
- Click Start / Run / cmd
- Type "P:\Tech&Ops\Scheduled Tasks\Report Output\MurexGFX.bat"

Note that mapped drives are often either visible under scheduled tasks
or are inaccessible because of permission issues.
 
Back
Top