Thanks for your replies and sorry for my poor english. Actually, the
following is my exact problem.

I need to run couple of batch files using the C# console application. I have
implemented the following code.

ProcessStartInfo psi = new ProcessStartInfo ( );
psi.WindowStyle = ProcessWindowStyle.Normal;
psi.FileName = @”Gen.bat”;
psi.Arguments = args;
psi.UseShellExecute = false;
psi.RedirectStandardOutput = stdout;
psi.WorkingDirectory = Environment.CurrentDirectory;
Process process = new Process ( );
process.StartInfo = psi;
process.Start ( );
Process.WaitForExit();

When i tried to execute from  my local machine, i didn't get any problem.

If i kept the application exe and the batch files in a shared folder of a
server machine and i tried to access from client machine, i got the
following error message.

*CMD.EXE was started with the above path as the current directory.UNC paths
are not supported. Defaulting to Windows directory.*

Any help would be appreciated.


Thanks In advance
Kiran



On Sun, May 31, 2009 at 10:54 PM, Vivek SHANTHARAM <[email protected]>wrote:

> is there any equivalent to impersonation, in console applications???? i am
> not clear whether impersonation is used only in asp.net of it can be used
> in console,windows apps also.
>
> On Sat, May 30, 2009 at 3:46 AM, The_Fruitman 
> <[email protected]>wrote:
>
>>
>> The way I understand your issue you've got a C# console application
>> sitting on a server and you're trying to get it to run by calling the
>> console application from a client machine and this is not working.
>> You are able to get your console application to work if you log into
>> the server and run it.  If this is the case I would assume it is a
>> trust issue.  The server does not trust the client to allow it to call
>> the exe.
>>
>> On May 29, 6:00 am, kiran babu <[email protected]> wrote:
>> > Hi All,
>> >
>> > I am working on C# console application and when I tried to access the
>> exe of
>> > the project from the remote machine, I am getting some problem. The main
>> > functionality is “The exe will execute couple of batch files, which are
>> > exist in the exe folder only.
>> >
>> > Currently, we have placed all required batch files and the exe in a
>> shared
>> > folder of a server machine and we are accessing the exe from the client
>> > machines.
>> >
>> > When we tried to access the exe from the server machine, we are not
>> getting
>> > any problem. But, when ever we tried to access the exe from the client
>> > machine, we are getting the problem.
>> >
>> > Here is my sample code:
>> >
>> > ProcessStartInfo psi = new ProcessStartInfo ( );
>> >
>> > psi.WindowStyle = ProcessWindowStyle.Normal;
>> >
>> > psi.FileName = @”Gen.bat”
>> >
>> > psi.Arguments = args;
>> >
>> > psi.UseShellExecute = false;
>> >
>> > psi.RedirectStandardOutput = stdout;
>> >
>> > psi.WorkingDirectory = Environment.CurrentDirectory;
>> >
>> > Process process = new Process ( );
>> >
>> > process.StartInfo = psi;
>> >
>> > process.Start ( );
>> >
>> > The above code was implemented for execution of the batch files. I don’t
>> the
>> > reason, why the above code is giving the problem, when we tried to
>> access it
>> > from the remote machines.
>> >
>> > Could you please let me know “Is there any mistake in my code” and how
>> to
>> > solve the above one?
>> >
>> > Thanks in Advance
>> >
>> > Kiran**
>> >
>> > * *
>>
>
>

Reply via email to