- 5
- 0
- 约3.24千字
- 约 4页
- 2020-09-16 发布于天津
- 举报
設定程序名 設定程式執行參數 關閉 Shell 的使用 重定向標準輸入 重定向標準輸出 重定向錯誤輸出 設置不顯示窗口
設定程序名 設定程式執行參數 關閉 Shell 的使用 重定向標準輸入 重定向標準輸出 重定向錯誤輸出 設置不顯示窗口
也可以用這種方式輸入要
不過要記得加上 Exit 要不
從輸出流取得命令執行結
private string RunCmd(string command)
{
// 實例一個 Process 類,啟動一個獨立進程
Process p = new Process();
//Process 類有一個 StartInfo 屬性,這個是 ProcessStartInfo 類,包括了一 些屬性和方法,下面我們用到了他的幾個屬性:
p.StartInfo.FileName = cmd.exe; //
p.StartInfo.Arguments = /c + command; // p.StartInfo.UseShellExecute = false; // p.StartInfo.RedirectStandardInput = true; // p.StartInfo.RedirectStandardOutput = true; // p.StartInfo.RedirectStandardError = true; // p.StartInfo.CreateNoWindow = true; //
p.Start(); // 啟動
//p.StandardInput.WriteLine(command); // 執行的命令
//p.StandardInput.WriteLine(exit); // 然下一行程式執行的時候會當機
return p.StandardOutput.ReadToEnd(); // 果
private static SearchResultCollection _ADHelper(string domainADsPath, string username, string password, string schemaClassNameToSearch)
{
DirectorySearcher searcher = new DirectorySearcher();
searcher.SearchRoot = new DirectoryEntry(domainADsPath,username, password); searcher.Filter = (objectClass= + schemaClassNameToSearch + );
searcher.SearchScope = SearchScope.Subtree;
searcher.Sort = new SortOption(name,SortDirection.Ascending);
// If there is a large set to be return ser page size for a paged search
searcher.PropertiesToLoad.AddRange(new displayname, samaccountname, mail });string[]name,Path,searcher.PageSize
searcher.PropertiesToLoad.AddRange(new displayname, samaccountname, mail });
string[]
name,
Path,
SearchResultCollection results = searcher.FindAll(); return results;
// 参数 domainADsPath 是活动目录的域名,使用类似 LDAP:// 域名 的形式
// 参数 schemaClassNameToSearch 是过滤条件,
// objectClass=user 查询条件是所有的用户( USER)
}
public GetUserList()
{ }
public string [] ListUsers()
{
string path = LDAP://IP/CN=Users,DC=idm,DC=gad,DC=nec,DC=com,DC=cn;
// IP :ADIP 地址
// DC: 域例如 ,cn 可以写为 DC=sina,DC=com,DC=cn
// CN: 数据对象 指定要获取的内容
return ListUsers(path);
}
public string[] ListUsers(string path)
{
try
{
DirectoryEntry entry = new D
您可能关注的文档
最近下载
- 2025年无人机驾驶员执照欧洲(EASA)无人机法规对比专题试卷及解析.pdf VIP
- 2025年AWS认证DedicatedHosts支持的AMI类型与启动模式专题试卷及解析.pdf VIP
- 美容院服务合同(2025年最新规范).docx
- 上海市住建委《上海市建筑和装饰工程预算定额沪建标定〔2025〕1162号.docx VIP
- 2025年无人机驾驶员执照飞行监管责任体系专题试卷及解析.pdf VIP
- 2025年无人机驾驶员执照悬停失控应急处置流程专题试卷及解析.pdf VIP
- 2025年金融风险管理师利率风险结构易错题解析专题试卷及解析.pdf VIP
- 《最优控制与状态估计6》-公开课件.ppt VIP
- 标准图集-22G101-3 混凝土结构施工图平面整体表示方法制图规则和构造详图-独立基础、条形基础、筏形基础、桩基础.pdf VIP
- 2024黑龙江林业职业技术学院单招《数学》通关题库及答案详解【各地真题】.docx VIP
原创力文档

文档评论(0)