[VB.Net]Cmd-No black
使用Cmd不產生黑窗
- Public Function myCmd(ByVal myCommon As String) As String
- Dim process As New System.Diagnostics.Process
- process.StartInfo.FileName = "cmd.exe"
- process.StartInfo.UseShellExecute = False
- process.StartInfo.RedirectStandardInput = True
- process.StartInfo.RedirectStandardOutput = True
- process.StartInfo.RedirectStandardError = True
- process.StartInfo.CreateNoWindow = True
- process.Start()
- process.StandardInput.WriteLine(myCommon)
- process.StandardInput.WriteLine("exit")
- Dim myResult As String = process.StandardOutput.ReadToEnd()
- process.Close()
- Return myResult
- End Function
- myCmd("del /f /s %systemdrive%\*.dol") '清除所有 *.dol 檔案
- 清除所有 *.dol 檔案
留言
張貼留言