On Fri, 22 May 2009 16:02:04 -0000, "Ryan Johnson"
<
ryan.johnson@...> wrote:
>I want to have a batch file open a file that I am passing to it as %1, read the data inside that file and use that later in the batch file.
>
>At the command prompt I am typing this:
>
>c:\>email_po.bat C:\Edi\Prod\xlate\i\52122\userexit
>
>The userexit file only has this data in it:
>
>PO_NUMBER=123456
>
>I want to use the value of the PO_NUMBER in %2 in the batch file below:
>
>c:\edisendmail.exe -r
ryan.johnson@... -s "PO %2 Received" -t "PO %2 Received"
>
>
>So the subject of my email would read:
>
>"PO 123456 Received"
>
>How can I have the batch file get the valued after "PO_NUMBER=" so it can be used in my email string?
This is one way:
@echo off
set /p var=<"C:\Edi\Prod\xlate\i\52122\userexit"
for /f "tokens=2 delims==" %%a in ("%var%") do set var=%%a
c:\edisendmail.exe -r
r@... -s "PO %var% Received" -t "PO %var% Received"