Page 1 of 1

environment variable in cspro

Posted: December 2nd, 2018, 10:48 am
by muhaliraza
I define the variable PCNUM as environment variable. I want to call it in cspro. Kindly guide me how can i do this in cspro.

Re: environment variable in cspro

Posted: December 3rd, 2018, 5:53 am
by Gregory Martin
The CSPro language does not have a way to access environment variables directly. However, you can create a DOS batch file with the following contents:
echo %PCNUM% > pcnum.txt
You can execute that batch file with execsystem, and then you can use the setfile/fileread functions to read that file, pcnum.txt, to get the contents of the environment variable.