Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!wuarchive!uunet!bcstec!galileo!rfh3273 From: rfh3273@galileo.rtn.ca.boeing.com (Dick Harrigill) Newsgroups: comp.os.msdos.misc Subject: Passing path as Batch parameter Message-ID: <375@galileo.rtn.ca.boeing.com> Date: 3 May 91 21:00:58 GMT Organization: be30r Lines: 29 I have a generic problem with writing batch files. Can anyone provide a simple solution? PROBLEM: To be able to pass a path/directory to a batch file as a parameter, and be able to act upon a file within that directory. FOR EXAMPLE: 1. doit c: 2. doit a:\mydir 3. doit c:\mydir\ where file doit.bat references a file using %1 as the path. Within doit.bat: %1FILENAME will work with example 1 & 3 but not 2. %1\FILENAME will work with example 2 but not 1 (as it will incorrectly point to the root) and not 3 (as you will get a double \). How do you write a generic batch file that will work with all cases above? -- Dick Harrigill, an independent voice from: Boeing Commercial Airplanes M/S 9R-49 PO BOX 3707 Renton Avionics/Flight Systems Seattle, WA 91824 Computing Support (206) 393-9539 rfh3273@galileo.rtn.ca.boeing.com