Article View: comp.sys.ibm.pc.programmer
Article #419Re: Current directory from batch file
From: Andy Sun Anu-guest
Date: Tue, 08 May 1990 01:57
Date: Tue, 08 May 1990 01:57
34 lines
1850 bytes
1850 bytes
In article <1990May8.003238.6922@agate.berkeley.edu> raymond@pepto-bismol.UUCP (Raymond Chen) writes:
>In article <90May7.072047edt.19230@me.utoronto.ca> sun@me.utoronto.ca (Andy Sun Anu-guest) writes:
>>I couldn't think of any combination of genuine DOS commands that can
>>accomplish that task.
>
>Closing my eyes and thinking real hard, I came up with this:
>
>Create a file that contains three characters. "c" "d" <space>.
>No trailing CR+LF! Put it in \usr\lib\cdspace
>
>Your batch file does this:
>
> copy \usr\lib\cdspace \tmp\cdspace.bat
> cd >>\tmp\cdspace.bat
> ... do whatever you want ...
> \tmp\cdspace
>
>Doesn't use the "call" command, so should even work on DOS 2.0.
>If you're clever, you can even teach cdspace.bat to erase itself when
>it's done, but it's no big deal leaving it in the \tmp directory,
>since everybody has a "del \tmp\*.*" in their autoexec.bat, right? :-)
You've told half of the story, but what about the other half? I am
interested in how you create that \usr\lib\cdspace file. I don't know
of any smart way to get this done except by a line of C code:
main() {printf("cd ");}
Is there editor/word processor out there that can kill CR+LF?
BTW, "cd>>\tmp\cdspace.bat" was neat. I didn't know you can do it this way
before.
Andy
Technical Details
Message-ID:
<90May7.215707edt.19841@me.utoronto.ca>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!me!sunReferences:
<90122.175401MCCABE@MTUS5.BITNET> <10153.26405d35@vax1.cc.lehigh.edu> <1873@gannet.cl.cam.ac.uk> <90May7.072047edt.19230@me.utoronto.ca> <1990May8.003238.6922@agate.berkeley.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!me!sun Newsgroups: comp.sys.ibm.pc.programmer From: sun@me.utoronto.ca (Andy Sun Anu-guest) Subject: Re: Current directory from batch file Message-ID: <90May7.215707edt.19841@me.utoronto.ca> Organization: University of Toronto, Department of Mechanical Engineering References: <90122.175401MCCABE@MTUS5.BITNET> <10153.26405d35@vax1.cc.lehigh.edu> <1873@gannet.cl.cam.ac.uk> <90May7.072047edt.19230@me.utoronto.ca> <1990May8.003238.6922@agate.berkeley.edu> Date: 8 May 90 01:57:18 GMT