Question : How to specify OS variables from VFP

On a prior EE suggestion, I an using Bullzip to create PDF files.

Bullzip allows a user specified filename by using an environment variable.

I am trying to set up an environment variable with the run command. . .

RUN set pdfname=c:\pdfs\clientname

This works fine from the OS command window but NOT from the VFP command window.

I don't get any errors, but           ? GETENV('pdfname')             displays nothing

Answer : How to specify OS variables from VFP

GETENV() returns parent process variables only (it obviously means variables set at OS level).

You may set the variable for VFP process by API call:

DECLARE INTEGER SetEnvironmentVariable IN kernel32 STRING lcVarName, STRING lcVarValue
lnSuccess = SetEnvironmentVariable("pdfname", "c:\pdfs\clientname")

Now you can see this variable in cmd window created from VFP by

! cmd

and it should be visible for Bullzip called from VFP, also.
Random Solutions  
 
programming4us programming4us