Thats because each Command is executed in a new Shell.
In your case I think the easiest way would be to combine your commands with "&&" or ";".
e.g.
";" always executes the following commands
http://www.livefirelabs.com/unix_tip_trick_shell_script/june_2003/06232003.htm
Another approach would be to use CreateShell() to write/read and use the input/output.
In your case I think the easiest way would be to combine your commands with "&&" or ";".
e.g.
cmd = sshClient.CreateCommand("cd /nfs/iil/proj && pwd");
or cmd = sshClient.CreateCommand("cd /nfs/iil/proj; pwd")
"&&" executes the following command just if the previous command succeeded";" always executes the following commands
http://www.livefirelabs.com/unix_tip_trick_shell_script/june_2003/06232003.htm
Another approach would be to use CreateShell() to write/read and use the input/output.