Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
how to determine a script location?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  7 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Jeff Jarrell  
View profile  
 More options Jun 1 2007, 11:18 am
Newsgroups: microsoft.public.windows.powershell
From: "Jeff Jarrell" <jjarrelS...@yahoo.com>
Date: Fri, 1 Jun 2007 11:18:36 -0400
Local: Fri, Jun 1 2007 11:18 am
Subject: how to determine a script location?
Inside a basic .PS1 script how do I determine the location of the PS1.  What
i am doing is I want to locate a config file which will be located in the
same dir as the script.

Thanks,
jeff


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Alex Harden  
View profile  
 More options Jun 1 2007, 1:34 pm
Newsgroups: microsoft.public.windows.powershell
From: Alex Harden <ahar...@gmail.com>
Date: Fri, 01 Jun 2007 17:34:24 -0000
Local: Fri, Jun 1 2007 1:34 pm
Subject: Re: how to determine a script location?
On Jun 1, 11:18 am, "Jeff Jarrell" <jjarrelS...@yahoo.com> wrote:

> Inside a basic .PS1 script how do I determine the location of the PS1.  What
> i am doing is I want to locate a config file which will be located in the
> same dir as the script.

> Thanks,
> jeff

$(pwd).path

-a


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
RichS  
View profile  
 More options Jun 1 2007, 1:45 pm
Newsgroups: microsoft.public.windows.powershell
From: RichS <Ri...@discussions.microsoft.com>
Date: Fri, 1 Jun 2007 10:45:02 -0700
Local: Fri, Jun 1 2007 1:45 pm
Subject: Re: how to determine a script location?
Could also use

$myinvocation.mycommand.path

see
http://msgoodies.blogspot.com/2007/04/powershell-writing-debug-output...  
for more information
--
Richard Siddaway
Please note that all scripts are supplied "as is" and with no warranty
Blog: http://richardsiddaway.spaces.live.com/
PowerShell User Group: http://www.get-psuguk.org.uk


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Brandon Shell  
View profile  
 More options Jun 1 2007, 2:38 pm
Newsgroups: microsoft.public.windows.powershell
From: "Brandon Shell" <tshell.m...@gmail.com>
Date: Fri, 1 Jun 2007 14:38:11 -0400
Local: Fri, Jun 1 2007 2:38 pm
Subject: Re: how to determine a script location?
I would be careful using $pwd as it only tells you the current Path which
could be changed.

Using: $myinvocation.mycommand.path (as Rich Suggest) is much better IMO.

"Alex Harden" <ahar...@gmail.com> wrote in message

news:1180719264.315742.199840@q66g2000hsg.googlegroups.com...


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Clint Bergman  
View profile  
 More options Jun 1 2007, 3:00 pm
Newsgroups: microsoft.public.windows.powershell
From: "Clint Bergman" <cl...@psd267.wednet.edu>
Date: Fri, 1 Jun 2007 12:00:34 -0700
Local: Fri, Jun 1 2007 3:00 pm
Subject: Re: how to determine a script location?
If it will be in a script, you can also get the path to the script's location with:

split-path $myinvocation.scriptname

~Clint


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
William Stacey [C# MVP]  
View profile  
 More options Jun 1 2007, 3:30 pm
Newsgroups: microsoft.public.windows.powershell
From: "William Stacey [C# MVP]" <william.sta...@gmail.com>
Date: Fri, 1 Jun 2007 15:30:50 -0400
Local: Fri, Jun 1 2007 3:30 pm
Subject: Re: how to determine a script location?
While on the subject, I noticed things like UserAppDataPath are not relevant
inside a cmdlet.
Console.WriteLine("AppDir:"+Application.UserAppDataPath);

AppDir:C:\Documents and Settings\Administrator\Application Data\Microsoft
Corporation\Microsoftr Windowsr Operating System\6.0.5430.0

I realize this is because it is probably using the Powershell.exe info as it
is the exe.  However, it would seem like this should be fixed somehow to
allow cmdlets to use this info consistent with other applications.
--
William Stacey [C# MVP]
PowerLocker, PowerPad
www.powerlocker.com

"Jeff Jarrell" <jjarrelS...@yahoo.com> wrote in message

news:%23g%23IzBGpHHA.3772@TK2MSFTNGP03.phx.gbl...
| Inside a basic .PS1 script how do I determine the location of the PS1.
What
| i am doing is I want to locate a config file which will be located in the
| same dir as the script.
|
| Thanks,
| jeff
|
|

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jeff Jarrell  
View profile  
 More options Jun 1 2007, 3:56 pm
Newsgroups: microsoft.public.windows.powershell
From: "Jeff Jarrell" <jjarrelS...@yahoo.com>
Date: Fri, 1 Jun 2007 15:56:59 -0400
Local: Fri, Jun 1 2007 3:56 pm
Subject: Re: how to determine a script location?
this is what I was looking for.  Thanks.

"RichS" <Ri...@discussions.microsoft.com> wrote in message

news:2170ECCA-1467-48BC-A369-FBB42A1427DC@microsoft.com...


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »