MS-DOS

Moderators: blip
Number of threads: 389
Number of posts: 904

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Storing a directory path in a variable Posted by jwondrusch on 30 Jun 2008 at 12:54 PM
Hi all - first post at programmersheaven.com!

I've been developing a small backup utility that relies on the 7-zip command line utility. It all works well but I'm hoping to streamline it a bit, as well as making it easier to update because it may be used in multiple locations and networks.

So my first question is, is it possible to store a directory path as a variable? For example, I'd like to be able to put C:\Documents and Settings\User Name\Desktop\ into the variable %backupDir% but I've been able to use it as such. I'd like to use that to change to the directory i'm backing up via the cd command:

cd %backupDir%

I've tried using CHDIR as well, to no avail. I've tried using quotes, using %20 instead of spaces, tried using %userprofile% for the first part of the path and I haven't had any success using variables instead of absolute or relative paths. Please help?

The second question I have is regarding error catching. Is it possible to use batch to monitor the 7-zip utility and to cancel it if it encounters an error? or do I have to let it run the entire way and then cancel the results at the end?

Thanks for any help you may be able to ovver



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.