簡體   English   中英

在不加載任何配置文件的情況下運行 powershell .ps1 腳本

[英]Running a powershell .ps1 script without loading any profile

我正在嘗試在 Windows 2012R2 中運行 powershell 腳本版本 5.1

powershell.exe -NoProfile D:\\test2.ps1 在 powershell 命令控制台(我不使用系統上的任何配置文件的腳本會話)

現在我在 test.ps1 腳本中檢查 test.ps1 腳本中加載了哪些配置文件

$profile


我得到輸出C:\\Users\\XXXXX\\Documents\\WindowsPowerShell\\Microsoft.PowerShell_profile.ps1

任何想法為什么在我的會話中啟動任何配置文件。

配置文件未加載,因為您在powershell.exe上指定了-NoProfile 但是,仍然定義了$profile變量。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM