.:: CODE SNIPPET ::.

"Your time is limited, so don't waste it living someone else's life"

Tag Archives: console

Copy file in LAN network


The mechanism of copying files in a local network is the same when you query data from a database. We get 3 basic steps:

  • Map the network drive – as open connection
  • Copy file – as query data
  • Reject the above drive – as close connection

The first and the last steps are done with net.exe windows program while the second step works with the normal File.Copy functionality.

First step – Map the network
Read more of this post

Start process without console window


To start a process and get out it’s output stream, you can use ProcessStartInfo like:

var startInfo = new ProcessStartInfo("net.exe", "use \\192.168.100.10")
                {
                    UseShellExecute = false,
                    CreateNoWindow = true
                };
var process = Process.Start(startInfo);
process.WaitForExit();
%d bloggers like this: