Article ID: 66292 - View products that this article applies to.
This article was previously published under Q66292
This article describes the several steps needed to use the results of a query (using the FIND filter) as a replaceable parameter in a one or more batch files. A use for this would be to search for a specific file and then perform some action on or with this file. The file could then be used in one or more batch files as a replaceable parameter.
First, you need to set up a one-line file with the partial command
with no carriage return (CR) or linefeed (LF) at the end (this can be done with COPY CON by pressing CTRL+Z after the equal sign [=] and pressing ENTER).
The file would look like this on the screen:
The following steps can be issued from the MS-DOS command prompt or from within a batch file:
C:\>COPY CON INIT.TXT SET VARNAME=^Z
NOTE: This process works for directory names only if MS-DOS 5.0 or 6.0 is being used. Under MS-DOS 5.0 and 6.0, the /B switch must be used when you are searching for a directory name. The following is an example of searching for a directory under MS-DOS 5.0 or 6.0.
NOTE: There is still a 127-character limit to the length of this variable, which includes the variable name and equal sign (=).
dir /b | find "dos5" > textfile
Article ID: 66292 - Last Review: May 10, 2003 - Revision: 2.0
Contact us for more help
Connect with Answer Desk for expert help.