• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 268
  • Last Modified:

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

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
karlika
Asked:
karlika
2 Solutions
 
oBdACommented:
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
 
TezdreadCommented:
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
 
karlikaAuthor Commented:
<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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now