Reputation: 175
I want to write powershell script to get the latest version of project using powershell.
I have the function and code with me . But I am not able to figure it out what are the steps the run the script.
Here is the code:
function Get-LatestVersion() {
$location = get-location
tf.exe get $location / version:T / recursive / force
}
. TFSExtensions.ps1
Please can anyone help me.
Upvotes: 0
Views: 747
Reputation: 96
Assuming you are in the PowerShell console or ISE and have changed your directory to the location you want to sync... You need to "dot source" the file that contains your function (or add it to your profile) so the function is defined in your environment. It appears like TFSExtensions.ps1 is the name you or someone gave it. You type a period followed by a space followed by the path to the file and filename (i.e. . ....\MyTools\TFSExtensions.ps1).
Once the function is defined, you can run it by typing its name (and any parameters, if any) which in this case is just Get-LatestVersion. This function takes the directory that you are working in as the workspace location. BTW:The forward slashes (/) in the tf.exe command line look like they are not needed. I was able to run the command without them. Steve
Upvotes: 1