[英]powershell get computer name where is script located when running from another computer
我有可以從另一台計算機執行的腳本。
如何獲取位置腳本的名稱? 只是名稱,而不是完整路徑(因為腳本可以分布在任何地方),謝謝
我自己解決了。 :-)希望對某人有幫助。
$scriptPath = Split-Path -Parent $MyInvocation.MyCommand.Definition
[string[]]$sth = $scriptPath.Split('\',[System.StringSplitOptions]::RemoveEmptyEntries)
$servername = $sth[0]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.