zoukankan      html  css  js  c++  java
  • 共享目录

     1     public static class ShareFolder
     2     {
     3         /// <summary>
     4         /// 自动为用户创建及设置共享目录,以方便用户。
     5         /// </summary>
     6         public static void SetShareFolder()
     7         {
     8             const string shareFolderPath = @"C:SMLShareFolder";
     9 
    10             string proFolderPath = Path.Combine(shareFolderPath, "PRO");
    11 
    12             if (!Directory.Exists(shareFolderPath))
    13             {
    14                 Directory.CreateDirectory(shareFolderPath);
    15             }
    16 
    17             if (!Directory.Exists(proFolderPath))
    18             {
    19                 Directory.CreateDirectory(proFolderPath);
    20             }
    21 
    22             string args = string.Format(@"net share FlexiPrintShareFolder={0} /grant:everyone,full", shareFolderPath);
    23          
    24             var psi = new ProcessStartInfo("netsh", args);
    25             psi.UseShellExecute = true;
    26             psi.Verb = "runas";
    27             psi.CreateNoWindow = true;
    28             psi.WindowStyle = ProcessWindowStyle.Hidden;
    29             psi.UseShellExecute = true;
    30             Process.Start(psi).WaitForExit();
    31         }
    32     }
  • 相关阅读:
    代码对齐[UVA1593]
    数数字
    子序列
    细菌培养
    内联函数那些事情
    一个简单的问题
    头文件重复包含问题的一点笔记
    mapreduce 对文件分词读取
    hadoop hive-2.3.5安装
    hadoop sqoop 实例
  • 原文地址:https://www.cnblogs.com/JustYong/p/5740325.html
Copyright © 2011-2022 走看看