簡體   English   中英

目錄名稱無效-Powershell腳本

[英]The directory name is invalid - Powershell Script

我是一名管理員,正在學習腳本,但是試圖創建一個腳本以另一個用戶身份打開多個程序(我的管理員密碼)

從powershell ise運行時,以下腳本運行良好,但是右鍵單擊並選擇"run with powershell"時,以下腳本將無法正常"run with powershell"

Start-Process -FilePath "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" -Credential "domain\userid"

在運行時,它會提示您輸入密碼,但不會彈出谷歌瀏覽器。 從Powershell ISE運行時,它工作正常,並且從Powershell.exe(不是ISE環境)運行腳本時,出現錯誤"The directory name is invalid"

添加工作目錄:

Start-Process `
    -FilePath "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" `
    -Credential "domain\userid" `
    -WorkingDirectory "C:\Program Files (x86)\Google\Chrome\Application\"

暫無
暫無

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

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