Don't understand the concept of environment PATH variable

Hi all,

I am not understanding the concept of PATH variable.

we are defining different path in this PATH variable. I am using one zip file and not specifying the path. See the ziputility variable in below code..

{

string arguments = @" -o " + ZipFileName;

string zipUtility = @"unzip.exe";

ProcessStartInfo startInfo = new ProcessStartInfo(zipUtility, arguments);

startInfo.CreateNoWindow = true;

startInfo.UseShellExecute = false;

startInfo.WindowStyle = ProcessWindowStyle.Hidden;

startInfo.RedirectStandardOutput = false;

startInfo.WorkingDirectory = directoryName;

Process proc = Process.Start(startInfo);

proc.WaitForExit();

}

i am not giving the path for unzip.exe file. so it should take from Environment.CurrentDirectory.. right

but in Environment.CurrentDirectory(C:\myProject\bin) also file is not there. still it's working for one application as in PATH (Environmen Variable) it's path(C:\Program Files\ZipUtility) is there.

But for another application with the same code it's giving error saying that file not found. Please Help me out in this.................................




Answer this question

Don't understand the concept of environment PATH variable

  • Mazzica

    Thanks shamir for reply....

    But here problem is

    in one application it's giving error that file not found...and in another application

    it's working fine(that application I have not written) with same user.

     

    So can anyone tell that should we write anything so that application uses that PATH variable's paths.

     



  • Littletommy

    Hi,

    Environment variables can be set at two levels,

    • User level
    • System level

    Likely problem is your case is environment variable pointing to "c:\program files\ziputility" is set at user level. Go to MyComputer -> Properties -> Advanced tab -> Environment variables and make sure you have the path defined at system level.

    Shamir


  • Don't understand the concept of environment PATH variable