批處理腳本可以知道它是否從PowerShell調用(沒有額外的參數feeded)嗎?批處理腳本可以知道它是否從PowerShell中調用?
需要這樣的東西..
if (%THIS_BATCH_CALLED_FROM_POWERSHELL%)
... warn the user or drop back to powershell to execute the proper instructions...
問題與this question - virtualenv-in-powershell有關。
我不確定我是否理解這個問題。批處理文件不是從PowerShell直接執行的。在PowerShell中執行批處理文件時,會生成一個新的cmd.exe實例來執行批處理文件的實際執行。 – 2009-09-02 21:26:13
我想他想找到一種在Powershell環境中更改環境變量的方法。 – JasonTrue 2009-09-02 21:36:11
@凱斯希爾:沒錯。我正在尋找一種方法來從批處理腳本中知道是否從PS中調用它。 – 2009-09-02 22:51:52