91精产品自偷自偷综合官网版下载-91精产品自偷自偷综合下-91精品-91精品91久久久-91精品成人-91精品成人www

網站建設資訊

NEWS

網站建設資訊

vb.net用shell的簡單介紹

VB.net中用shell運行bat失敗 請教

我覺得應該有兩種解決方法

網站建設哪家好,找創新互聯公司!專注于網頁設計、網站建設、微信開發、小程序制作、集團企業網站建設等服務項目。為回饋新老客戶創新互聯還提供了清徐免費建站歡迎大家使用!

1:把patran的安裝路徑添加到系統環境變量的path屬性下;

2:在你的批處理里面改為如下格式,patran完整路徑(如c:\MSC.software\········patran.exe)+ "-sfp patran.ses",也就是下面這種情況試下“c:\MSC.software\········patran.exe -sfp patran.ses -b -ans yes”

vb.net中用shell調用外部exe一直報"未找到文件"的錯誤,但是路徑確實是對的

一般情況下寧可相信計算機也不要太相信自己。

給你個測試的方法,你可以使用File.Create在你上述認為正確的路徑創建一個文件試試,看是否創建到你想要的地方了。

vb.net shell

Shell恐怕不行·

給你個現成的:

Sub _CMD(ByVal Data As String)

Try

Dim p As New Process()‘用Process就可以

p.StartInfo.FileName = "cmd.exe"

p.StartInfo.UseShellExecute = False

p.StartInfo.RedirectStandardInput = True

p.StartInfo.RedirectStandardOutput = True

p.StartInfo.RedirectStandardError = True

p.StartInfo.CreateNoWindow = True

p.Start()

Application.DoEvents()

p.StandardInput.WriteLine(Data)’這個Data就是cmd命令

p.StandardInput.WriteLine("Exit")‘這個是退出語句

Dim strRst As String = p.StandardOutput.ReadToEnd()’執行完語句后取得顯示內容.

p.Close()

Catch ex As Exception

End Try

‘之后就是你自己的代碼了...

End Sub

VB.net中的shell在C#中怎么寫

下面是例子,或許對你有用:

using???System;???

using???System.Diagnostics;???

using???System.ComponentModel;???

namespace???MyProcessSample???

{???

///???summary???

///???Shell???for???the???sample.???

///???/summary???

public???class???MyProcess???

{???

//???These???are???the???Win32???error???code???for???file???not???found???or???access???denied.???

const???int???ERROR_FILE_NOT_FOUND???=2;???

const???int???ERROR_ACCESS_DENIED???=???5;???

///???summary???

///???Prints???a???file???with???a???.doc???extension.???

///???/summary???

public???void???PrintDoc()???

{???

Process???myProcess???=???new???Process();???

try???

{???

//???Get???the???path???that???stores???user???documents.???

string???myDocumentsPath???=?????

Environment.GetFolderPath(Environment.SpecialFolder.Personal);???

myProcess.StartInfo.FileName???=???myDocumentsPath???+???"\\MyFile.doc";?????

myProcess.StartInfo.Verb???=???"Print";???

myProcess.StartInfo.CreateNoWindow???=???true;???

myProcess.Start();???

}???

catch???(Win32Exception???e)???

{???

if(e.NativeErrorCode???==???ERROR_FILE_NOT_FOUND)???

{???

Console.WriteLine(e.Message???+???".???Check???the???path.");???

}?????

else???if???(e.NativeErrorCode???==???ERROR_ACCESS_DENIED)???

{???

//???Note???that???if???your???word???processor???might???generate???exceptions???

//???such???as???this,???which???are???handled???first.???

Console.WriteLine(e.Message???+?????

".???You???do???not???have???permission???to???print???this???file.");???

}???

}???

}???

public???static???void???Main()???

{???

MyProcess???myProcess???=???new???MyProcess();???

myProcess.PrintDoc();???

}???

}???

}


本文題目:vb.net用shell的簡單介紹
網站地址:http://www.yuzhuanjia.cn/article/doedhpc.html
主站蜘蛛池模板: 91一区二区午夜免费 | 91高清无码大片 | 午夜性色福利影院 | av片在线观看网站免费的 | 99在线在线视频免费视频观看 | 91精品国产色综合久久蜜臀 | 99re久久在热线播放最新地址 | 91产国天堂游戏 | av片亚洲国产 | 91久久人人妻人人澡人人爽 | 91久久久无码国产精精品品不卡 | ts人妖在线 | 午夜无遮挡男女啪啪免费软件 | 一区二区三区欧美亚洲 | 囯产亚州中文字幕美日韩在线 | 福利视频网址 | 成人午夜影院 | 91精品全国免费观看青青 | 91麻豆精品无码一区二区三区 | 91精品国产麻豆国产自 | 成人免费www在线高清观看 | 高清无码喷水一区 | 国产91精品成人不卡在线观看 | 91精品国产麻豆国产 | 东京热主页| av中文字幕网址 | 高清国产一级婬片a片 | 一区二区三区亚洲中文字幕 | 午夜福利一| 国产av丝袜美腿丝袜网站 | 午夜国产一区二区三区在线观看 | 99精品综合网站 | 午夜少妇性开放影院 | 午夜麻豆精品无码 | 丰满白嫩大屁股ass 丰满白嫩的大屁股xxxxx视频 | 91人妻成人精品一区二区 | 午夜国产欧美理论在线播放 | 99re热视频 | 99re在线视频精品 | 91新网址 | av免费一区二区三区 |