🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.ibm.pc.programmer
Article #445

Re: Current directory from batch file

#445
From: Tim Hudson
Date: Wed, 09 May 1990 06:09
42 lines
2121 bytes
In article <90May7.072047edt.19230@me.utoronto.ca> sun@me.utoronto.ca (Andy Sun Anu-guest) writes:
>I thought what the original poster asked was:
>(1) say, you are in C:\DIR1
>(2) you execute a batch file which have a lot of CDs so that at the end
>    of the batch file, you end up in, say, C:\DIR2\DIR3\DIR4.
>(3) upon terminate of the batch file, you need to go back to C:\DIR1
>    automatically.
>I couldn't think of any combination of genuine DOS commands that can 
>accomplish that task. 

	Well, how about this sort of trick:

1. 	Have a file with just a "cd " in it - NO newline on the end (must
	make sure of this)
	call this file \cd.dat

2.	in your batch file do the following

	copy \cd.dat \tmpname.bat
	cd >> \tmpname.bat
	.
	.
	do all your other things
	.
	.
	\tmpname

	That works perfectly under MS-DOS 3.30 at least.

	Basically, cd with no args gives current working directory - make
a batchfile that will take you back there - hence need a cd with no newline.
The files should be in a fixed location as you need to know where they are.
Similar things can be done to save the path etc. Using this you can
have a one level pushdir and popdir written as batchfiles.

Tim Hudson
--
Language Centre              internet    : tjh@lance.hss.bu.oz{.au}
Bond University              JANET       : tjh%lance.hss.bu.oz@uk.ac.ukc
Gold Coast, Qld 4229         ARPA, bitnet: tjh%lance.hss.bu.oz.au@uunet.uu.net
Australia                    UUCP        : ..!uunet!munnari!lance.hss.bu.oz!tjh
-- 
Technical Details
Message-ID: <5111@lance.hss.bu.oz.au>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!munnari.oz.au!metro!bunyip!lance!tjh
References: <90122.175401MCCABE@MTUS5.BITNET> <10153.26405d35@vax1.cc.lehigh.edu> <1873@gannet.cl.cam.ac.uk> <90May7.072047edt.19230@me.utoronto.ca>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!munnari.oz.au!metro!bunyip!lance!tjh
From: tjh@lance.hss.bu.oz.au (Tim Hudson)
Newsgroups: comp.sys.ibm.pc.programmer
Subject: Re: Current directory from batch file
Message-ID: <5111@lance.hss.bu.oz.au>
Date: 9 May 90 06:09:04 GMT
References: <90122.175401MCCABE@MTUS5.BITNET> <10153.26405d35@vax1.cc.lehigh.edu> <1873@gannet.cl.cam.ac.uk> <90May7.072047edt.19230@me.utoronto.ca>
Reply-To: tjh@lance.hss.bu.oz (Tim Hudson)
Organization: Language Centre, Bond University, Australia.
Lines: 42