%SYN_SETDIR

Set the current directory path

WSupported on Windows
USupported on Unix
VSupported on OpenVMS
NSupported in Synergy .NET
status = %SYN_SETDIR(path)

Return value

status

Returns 1 if successful or 0 if unsuccessful. (n)

Arguments

path

The path for the directory you want to set as the current directory. (a)

Discussion

%SYN_SETDIR does not support relative paths (for example, ..\) or logicals.

On Windows, although changing a directory to a UNC path is valid, doing so restricts you from subsequently spawning any command that uses the command interpreter cmd.exe, because cmd does not support a default directory of anything other than a mapped or subst drive. For example, you would not be able to spawn (or do an open pipe) of a dir command or spawn a .bat command procedure.

If %SYN_SETDIR is not successful, the system error code can be retrieved using %SYSERR.

Examples

This example sets the current directory path to C:\mydir.

record
    sts         ,i4
proc
    sts = %syn_setdir("C:\mydir")
    if (.not. sts)
      writes(1, "cannot change to required directory")