![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | How to get the full path for the PS1 itself? I would like to know how to get the path for the own script (PS1) using Powershell. It's something like this in VBScript: Set oFS = CreateObject( "Scripting.FileSystemObject" ) ScriptFullPath = oFS.GetParentFolderName( WScript.ScriptFullName) or Set oFS = CreateObject( "Scripting.FileSystemObject" ) ScriptFullPath = oFS.GetAbsolutePathName( ".\" ) or Dim oWS : Set oWS = CreateObject( "WScript.Shell" ) WScript.Echo oWS.CurrentDirectory Does anyone know something similar using Powershell? Thanks! Felipe |
My System Specs![]() |
| | #2 (permalink) |
| | Re: How to get the full path for the PS1 itself? Use this: $MyInvocation.MyCommand.Path To get an idea of what's exposed to you from within a script, you can create a sample script with this content: $MyInvocation | fl * $MyInvocation | gm "Carlos Felipe França da Fonseca" <carlosfelipefranca@xxxxxx> wrote in message news:e9bMgBW8JHA.4176@xxxxxx Quote: > I would like to know how to get the path for the own script (PS1) using > Powershell. > It's something like this in VBScript: > > Set oFS = CreateObject( "Scripting.FileSystemObject" ) > ScriptFullPath = oFS.GetParentFolderName( WScript.ScriptFullName) > > or > > Set oFS = CreateObject( "Scripting.FileSystemObject" ) > ScriptFullPath = oFS.GetAbsolutePathName( ".\" ) > > or > > Dim oWS : Set oWS = CreateObject( "WScript.Shell" ) > WScript.Echo oWS.CurrentDirectory > > > Does anyone know something similar using Powershell? > > Thanks! > > Felipe > > > |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| What's file's full path and BIOS | Vista file management | |||
| how to get subdir items with full path name? | PowerShell | |||
| Full path in the Address bar of Explorer??? | Vista installation & setup | |||
| BUG/ANNOYANCE: PoSH autocompletes the full path rather than a minimal path | PowerShell | |||
| full path versus ./filename | PowerShell | |||