请问各位大虾,怎样在程序中得到环境变量PATH的值,小弟先谢过了(200分)

  • 主题发起人 主题发起人 lsha
  • 开始时间 开始时间
L

lsha

Unregistered / Unconfirmed
GUEST, unregistred user!
D:/>path
PATH=E:/Oracle/Ora81/bin;D:/Program Files/Oracle/jre/1.1.7/bin;D:/Program Files/
Borland/Delphi7/Bin;D:/Program Files/Borland/Delphi7/Projects/Bpl/;D:/WINNT/syst
em32;D:/WINNT;D:/WINNT/System32/Wbem;d:/sybase/dll;d:/sybase/bin;D:/Program File
s/Microsoft SQL Server/80/Tools/BINN;D:/PROGRA~1/ULTRAE~1;E:/Oracle/Ora81/orb/bi
n;D:/sybtools/WIN32;D:/sybtools/ASEP
就是要在程序中得到下面一大段目录字符串
请各位大虾帮帮忙吧!
 
GetEnvironmentVariable(pchar('WSNADDR'),@pwsnaddr,80);
 
GetEnvironmentVariable(pchar('WSNADDR'),@pwsnaddr,80);
 
GetEnvironmentVariable(pchar('WSNADDR'),@pwsnaddr,80);
 
谢谢zhoudongchao
 
function PuGetSplitSubStr(PaStr:string;PaPosition:integer;PaSplitter:string=';'):string;
var i:integer;
begin
for i:=0 to PaPosition do
begin
if Pos(PaSplitter,PaStr)<>0 then //返回位置不为零
begin
Result:=Copy(PaStr,1,Pos(PaSplitter,PaStr)-1); //
Delete(PaStr,1,Pos(PaSplitter,PaStr));
end else //返回值为零时
begin
Result:=PaStr;
PaStr:='';
end;
end;
end;
 
后退
顶部