home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / unix / question / 15349 < prev    next >
Encoding:
Text File  |  1993-01-08  |  3.1 KB  |  78 lines

  1. Newsgroups: comp.unix.questions
  2. Path: sparky!uunet!paladin.american.edu!gatech!swrinde!cs.utexas.edu!wupost!csus.edu!netcom.com!dman
  3. From: dman@netcom.com (Dallman Ross)
  4. Subject: Re: looking a utility to chdir without typing full path
  5. Message-ID: <1993Jan9.000845.15937@netcom.com>
  6. Organization: Netcom - Online Communication Services  (408 241-9760 guest) 
  7. X-Newsreader: TIN [version 1.1 PL8]
  8. References: <1ikvt1INNqq2@usenet.INS.CWRU.Edu>
  9. Date: Sat, 9 Jan 1993 00:08:45 GMT
  10. Lines: 66
  11.  
  12. Wei Jin Mai (cl820@cleveland.Freenet.Edu) wrote:
  13.  
  14. >      I just switch to Unix from Dos. Is there a utility or shell that let you
  15. >  change directory without typing full path? For example: chdir abc changes   
  16. >  working directory to /usr/local/src/abc .
  17. >  -- 
  18.  
  19. There are many ways to do this.  There are also a number of commercial
  20. utilities that provide for this, the preeminent one probably being Norton.
  21.  
  22. But you can very easily write your own little batch files to do the same
  23. thing.  Before I say more on that, I might mention that you can save your-
  24. self a lot of keystrokes by realizing that "cd" does exactly the same
  25. thing as "chdir."
  26.  
  27. Now for a batch-file example.  I have a subdirectory called BAT where
  28. I keep all of my batch files, and it's in my path; but you can put
  29. them anywhere they'll be found by your path.
  30.  
  31. Example of batch file to simplify changing dir's to
  32. C:\APPS\TEXTAPPS\WP51\WORK\LETTERS\BUSINESS (believe it or not, a
  33. real subdirectory on my computer):
  34.  
  35. ------------
  36. @echo off
  37. c:
  38. cd \apps\textapps\wp51\work\letters\business
  39. ------------
  40.  
  41. Use what's between the lines, and save it as, for example, WORK.BAT in
  42. the appropriate active directory.  Then, from any DOS prompt, you would
  43. just type "work" -- no need for even the "cd" referred to in the initial
  44. paragraphs -- and you'll be in the right directory.
  45.  
  46. That said, if you're not using a shell front to DOS and you're not using
  47. Windows, you still should rarely need to change directories manually.
  48. By making all your main applications active (in your path in AUTOEXEC.BAT)
  49. and by making batch files for the lesser-used ones, you will find that
  50. "cd" is a rare command indeed.
  51.  
  52. I run many of my apps from batch files rather than making all my program
  53. paths executable.  Here would be one for WordPerfect:
  54.  
  55. ----------
  56. @echo off
  57. c:
  58. cd \apps\textapps\wp51\wp
  59. cd \
  60. ----------
  61.  
  62. The reason I have the extra "cd \" at the end is to "clean up" by reverting
  63. to the root directory when I leave WordPerfect.  The batch file is still
  64. active the whole time I'm in WP, waiting for the exit, and then it
  65. puts me back in root.
  66.  
  67. WP51 has a feature whereby you can set up a default active-work directory,
  68. and I use that feature.  In another program, I might use the batch
  69. file to first move me to the proper subdirectory before initiating the
  70. program-executable.
  71.  
  72. --
  73.  __D_a l_l m a_n  _ R o_s s _ |dman@netcom.com  /or/  |"You sound like a man|
  74.  l  \\ l\\   /l  /\\  l\\   l |dross@well.sf.ca.us    |with a rubber nose." |
  75.  l   >)l \\ /ll /  \\ l \\  l |vox/fax: 1.510.645.1883| -- One-Lung Bill    |
  76.  l  // l  \X ll/--- \\l  \\ l |350 Perkins St., #108  |     Remmer (deceased)
  77. _l//______________________\\l_|Oakland,_CA__94610-3422|_____________________|_
  78.