欧美一级特黄大片做受成人-亚洲成人一区二区电影-激情熟女一区二区三区-日韩专区欧美专区国产专区

Powershell如何獲取異常的名稱-創(chuàng)新互聯(lián)

Powershell里面一般處理異常分為中斷類型和不可中斷類型。前者一般是通過try..catch..finally處理,后者一般通過ErrorAction, ErrorVariable處理。

專注于為中小企業(yè)提供成都做網(wǎng)站、成都網(wǎng)站制作服務(wù),電腦端+手機(jī)端+微信端的三站合一,更高效的管理,為中小企業(yè)蕪湖縣免費(fèi)做網(wǎng)站提供優(yōu)質(zhì)的服務(wù)。我們立足成都,凝聚了一批互聯(lián)網(wǎng)行業(yè)人才,有力地推動(dòng)了超過千家企業(yè)的穩(wěn)健成長,幫助中小企業(yè)通過網(wǎng)站建設(shè)實(shí)現(xiàn)規(guī)模擴(kuò)充和轉(zhuǎn)變。

通過try..catch處理的時(shí)候有一個(gè)問題就是catch后面跟的異常,他的名字到底怎么獲取的?

比如說我執(zhí)行,他會(huì)報(bào)錯(cuò),因?yàn)?nnnnn這個(gè)命令不存在。

PS C:\> a=nnnnn
a=nnnnn : The term 'a=nnnnn' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ a=nnnnn
+ ~~~~~~~
    + CategoryInfo          : ObjectNotFound: (a=nnnnn:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

如果我想使用try ..catch捕獲這個(gè)異常,如何知道這個(gè)異常的具體名字是什么?

可以通過$error這個(gè)變量來獲取,最新的報(bào)錯(cuò)就是 $error[0], 通過他可以知道具體的Exception是什么,這樣就可以有的放矢了。

PS C:\> $Error[0] | fl * -f
PSMessageDetails      : 
Exception             : System.Management.Automation.CommandNotFoundException: The term 'a=nnnnn' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a 
                        path was included, verify that the path is correct and try again.
                           at System.Management.Automation.CommandDiscovery.LookupCommandInfo(String commandName, CommandTypes commandTypes, SearchResolutionOptions searchResolutionOptions, CommandOrigin commandOrigin, 
                        ExecutionContext context)
                           at System.Management.Automation.CommandDiscovery.LookupCommandProcessor(String commandName, CommandOrigin commandOrigin, Nullable`1 useLocalScope)
                           at System.Management.Automation.ExecutionContext.CreateCommand(String command, Boolean dotSource)
                           at System.Management.Automation.PipelineOps.AddCommand(PipelineProcessor pipe, CommandParameterInternal[] commandElements, CommandBaseAst commandBaseAst, CommandRedirection[] redirections, 
                        ExecutionContext context)
                           at System.Management.Automation.PipelineOps.InvokePipeline(Object input, Boolean ignoreInput, CommandParameterInternal[][] pipeElements, CommandBaseAst[] pipeElementAsts, CommandRedirection[][] 
                        commandRedirections, FunctionContext funcContext)
                           at System.Management.Automation.Interpreter.ActionCallInstruction`6.Run(InterpretedFrame frame)
                           at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
TargetObject          : a=nnnnn
CategoryInfo          : ObjectNotFound: (a=nnnnn:String) [], CommandNotFoundException
FullyQualifiedErrorId : CommandNotFoundException
ErrorDetails          : 
InvocationInfo        : System.Management.Automation.InvocationInfo
ScriptStackTrace      : at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo : {}

比如這樣就行了

PS C:\> 
try{
a=nnnnn
}catch [System.Management.Automation.CommandNotFoundException]{
"error1"
}
error1

另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場(chǎng)景需求。

當(dāng)前名稱:Powershell如何獲取異常的名稱-創(chuàng)新互聯(lián)
當(dāng)前路徑:http://aaarwkj.com/article14/dihcge.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供商城網(wǎng)站、網(wǎng)站建設(shè)網(wǎng)站收錄、手機(jī)網(wǎng)站建設(shè)企業(yè)網(wǎng)站制作、定制網(wǎng)站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

商城網(wǎng)站建設(shè)
中国女人内射91熟女| 亚洲国产综合亚洲综合国产| 91好色视频在线观看| 亚洲小说欧美激情另类| 国产又粗又长在线视频| 国产自拍最新在线视频| 人妻有码中文字幕在线| 91九色视频免费观看| 色哟哟亚洲精品在线视频| 亚洲精品在线观看av| 国产三级在线播放完整| 日韩欧美亚洲综合久久精品| 一区二区三区特黄色片| 欧美精品国产精品久久| 日本午夜一区二区在线观看| 亚洲av成人在线不卡| 日本人妻成人免费大片| 内地精品露脸自拍视频| 少妇人妻偷人精品系列| 久久精品久久精品欧美大片| 欧美日韩亚洲一区二区搜索| 日韩精品视频在线不卡播放 | 91午夜福利国产在线观看| 久久精品一区二区三区不卡| 日韩亚洲中文一区三级黄片| 天天操天天夜夜操夜夜| 日韩中文字幕精品一区| 亚洲精品??一区二区| 午夜视频在线看一区免费| 天天操天天射夜夜撸| 国产成人综合亚洲国产| 天堂av中文字幕在线不卡| 四虎成人免费永久视频| 中文字幕有码精品在线| 门国产av一区二区三区| 人妻中文字幕精品系列| 欧美高清一区二区在线观看| 麻豆av永久地址久久精品| 精品欧美国产日韩在线观看| 日韩无码一区二区视频| 国产精品播放一区二区三区|