Solved

CD in a batch script called by the at task scheduler?

Posted on 2004-08-04
3
256 Views
Last Modified: 2010-04-13
Hi!

I got some problems with a batch script I wrote.
The intent is to backup a few files.
So Im trying to cd to a directory, zip it (my zip app requires to go to the parent directory), and copy it to a "secure" place.

So, when I start it manually, everything works fine.
Where from I start the batch script does not matter.

But when I create a task to run it every day, the script fails.
I have narrowed the problem down to the task no accepting cd commands in a batch script.

So why is that so, and how can I work around that?

Regards,
Marko

PS: Im bound to use that zip app...
0
Comment
Question by:karlika
3 Comments
 
LVL 83

Accepted Solution

by:
oBdA earned 65 total points
ID: 11713731
You can happily change paths in a scheduled script. Main question: where does your data reside that you want to zip, and where do you want to save it?
0
 
LVL 1

Assisted Solution

by:Tezdread
Tezdread earned 60 total points
ID: 11714287
Might not be relevant but what zip software are you using?

You might want to add the SET command to your batch file...something
like: SET OriginalDir=c:\your_directory
then instead of: CD c:\your_directory you'd add CD %OriginalDir%

That might sort it out.
0
 
LVL 2

Author Comment

by:karlika
ID: 11714589
<banging head against monitor/>

Mixing scripting for different OSes is seldom working ;)
I just forgot that Windows doesnt like it when you try to cd from one drive to another in one step ...

Oke, thanks for your postings.

Regards,
marko
0

Featured Post

[Webinar] Disaster Recovery and Cloud Management

Learn from Unigma and CloudBerry industry veterans which providers are best for certain use cases and how to lower cloud costs, how to grow your Managed Services practice in IaaS clouds, and how to utilize public cloud for Disaster Recovery

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

863 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

20 Experts available now in Live!

Get 1:1 Help Now