Solved

Avoid killing a job in batch files

Posted on 2009-05-14
5
293 Views
Last Modified: 2012-05-07
Hello,

I've a batch file, that take a while to complete. Consists in a deletion of a directory and its files, then change of drive, and lauch a command that takes long time to accomplish its job.

@del /Q e:\Dir\subdir
@rmdir e:\Dir\subdir /s /q
@c:
@cd "C:\program files\XXX\XX"
@command.exe -h ip1 -u administrator -p password -a ipaddr:ip2 -r e:\Dir\subdir -t fullvm -M 1 > E:\Dir\log.txt

The problem, is that,  often, we accees via TS for work, and in logoff, we kill the job.

It's possible to avoid this behaviour, with a instruction in a batch file
0
Comment
Question by:zsabo
  • 3
  • 2
5 Comments
 
LVL 40

Expert Comment

by:Kyle Abrahams
ID: 24388552
What if you made it part of the logoff script instead of the way you're launching it now?
0
 

Author Comment

by:zsabo
ID: 24388624
The part of script "command.exe -h ip1 -u administrator -p password -a ipaddr:ip2 -r e:\Dir\subdir -t fullvm -M 1", take more of 3-4 hours to complete. And often, we login and logoff...while the job is running.
0
 
LVL 40

Expert Comment

by:Kyle Abrahams
ID: 24388658
can you make it a scheduled task on the computer rather then have it run in user context?
0
 

Author Comment

by:zsabo
ID: 24388741
Batch file launches by means of a sheduled task, that too need a user context (administrator).
0
 
LVL 40

Accepted Solution

by:
Kyle Abrahams earned 500 total points
ID: 24388788
But that context will be local to the machine, not the logged in user.  You can even create a new user which will run the job locally.  The task should continue to run underneath the new user even though someone logs in.

0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

The following is a collection of cases for strange behaviour when using advanced techniques in DOS batch files. You should have some basic experience in batch "programming", as I'm assuming some knowledge and not further explain the basics. For some…
I have published numerous articles here at Experts Exchange that present programs/scripts written in a language called AutoHotkey. Each of those articles has a brief paragraph describing where to download the product and how to install it. I have al…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now