Simpler Navigation for Servers and Operating Systems - Please Update Your Bookmarks
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
If you have bookmarked forums or discussion boards in Servers and Operating Systems, we suggest you check and update them as needed.
Operating System - Microsoft
cancel
Showing results for 
Search instead for 
Did you mean: 

How to use a windows variable within perl scripting

Junior C.
Frequent Advisor

How to use a windows variable within perl scripting

All,

I have a perl script that need to trigger of an .exe for the following directory.

C:\Documents and Settings\All Users\Application Data\HP\HP BTO Software\bin\instrumentation

On the windows server "set" show the variable is set to OvAgentDir

I try the following none seem to work.

my $INST_DIR = "%OvAgentDir%";
my $INST_DIR = "C:\\DOCUME~1\\ALLUSE~1\\Application Data\\HP\\HP BTO Software";

I appreciate all help.

Thanks,

-Junior
2 REPLIES
James R. Ferguson
Acclaimed Contributor

Re: How to use a windows variable within perl scripting

Hi Junior:

How about:

# perl -e "my $INST_DIR='C:\DOCUME~1\ALLUSE~1\Application Data\HP\HP BTO Software';chdir $INST_DIR or print 'no can do'"

Regards!

...JRF...
ghostdog74
Occasional Advisor

Re: How to use a windows variable within perl scripting

you can get windows environment variable using ENV. eg $ENV{'OvAgentDir'}