How to add new path to current system path

rodbernardorodbernardo Member Posts: 34
edited 2008-05-13 in NAV Tips & Tricks
Hello gurus,

How can I add a new path string to the current system path?

Using Environ('Path') we can able to retrieve the current system path, but how to add new path string?

Current System Path:

Path = c:\windows;c:\windows\system32;

I want to add this path c:\temp;

New system path will be:

Path := c:\windows;c:\windows\system32;c:\temp;

Any work around? Which automation should we use?

Thanks in advance.

Sydney, Australia
Rodel Bernardo
Pressure is an opportunity.


  • tinoruijstinoruijs Member Posts: 1,226
    Use the 'Windows Script Host Object Model'.FileSystemObject'

    CreateFolder(NewFolder : Text[100]) : Boolean
    IF ISCLEAR(FileSystem) THEN
    IF NOT CREATE(FileSystem) THEN


    Take a look at the following post:

    Tino Ruijs
    Microsoft Dynamics NAV specialist
  • garakgarak Member Posts: 3,263
    the Systemvariable Path is stored in the registry key
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\Path

    so, you can use WshShell

    Name DataType Subtype Length
    WshShell Automation 'Windows Script Host Object Model'.WshShell

    if isclear(WshShell) then

    RegKey := 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\Path';

    Variantvariable := WshShell.RegRead(RegKey);


    Do you make it right, it works too!
  • rodbernardorodbernardo Member Posts: 34
    Genius, I got it working.

    Thanks guys.

    Sydney Australia
    Rodel Bernardo
    Pressure is an opportunity.
  • krikikriki Member, Moderator Posts: 9,079
    [Topic moved from Navision forum to Navision Tips & Tricks forum]
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!

Sign In or Register to comment.