Windows Paylaşım mapping silmek
Windows işletim sisteminde açık kalan paylaşımı silmek için cmd üzerinde şu komutu çalıştırabilirsiniz
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/c net use * /delete /y |
C# üzerinden bu işlemi yaptırmak istersek de şöyle bir şey yapabiliriz
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try | |
{ | |
System.Diagnostics.Process process = new System.Diagnostics.Process(); | |
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo(); | |
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; | |
startInfo.FileName = "cmd.exe"; | |
startInfo.Arguments = string.format("/c net use * /delete /y"); | |
process.StartInfo = startInfo; | |
process.Start(); | |
} | |
catch (Exception ex) | |
{ | |
Console.WriteLine(ex.ToString()); | |
} |