ฉันมีไฟล์ Powershell สองไฟล์ หนึ่งโมดูล และสคริปต์ที่เรียกใช้โมดูล
โมดูล: test.psm1
Function Get-Info {
$MyInvocation.MyCommand.Name
}
สคริปต์: myTest.ps1
Import-Module C:\Users\moomin\Documents\test.psm1 -force
Get-Info
เมื่อฉันวิ่ง ./myTest.ps1
ฉันได้รับ
Get-Info
ฉันต้องการคืนชื่อของสคริปต์การโทร (test.ps1) ฉันจะทำเช่นนั้นได้อย่างไร?
$MyInvocation.MyCommand.Name
จากสคริปต์ myTest.ps1 เพื่อรับข้อมูลนั้นล่ะ - person TheMadTechnician   schedule 29.04.2014