?
Solved

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

Posted on 2004-08-04
3
Medium Priority
?
262 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 85

Accepted Solution

by:
oBdA earned 130 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 120 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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

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…
Hey fellow admins! This time, I have a little fairy tale for you. As many tales do, it starts boring and then gets pretty gory. I hope you like it. TL;DR: It is about an important security matter, you should read it if you run or administer Windows …
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month12 days, 16 hours left to enroll

777 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