koshy75
asked on
Microsoft, Team Foundation Source Control, Command Line get command
I need to have a batch file (or equivalent) which would retrieve a particular directory from my TFS to a specific location on my PC.
(A)
I tried to use the "get" command from the command line as below:
TF get $/myProject/Assets/UseCase /version:T /overwrite /recursive /noprompt
but got the error
Unable to determine the workspace.
(B)
I then tried
runas /noprofile /user:MYDOMAIN\user cmd
this prompted me for my password
I then entered the password and the cmd window was launched
I navigated to "D:\Program Files\Microsoft Visual Studio 8\Common7\IDE>" (Installed in D drive) and tried
TF get $/myProject/Assets/UseCase /version:T /overwrite /recursive /noprompt
but got the error
Unable to determine the workspace.
Regards
Koshy75
(A)
I tried to use the "get" command from the command line as below:
TF get $/myProject/Assets/UseCase
but got the error
Unable to determine the workspace.
(B)
I then tried
runas /noprofile /user:MYDOMAIN\user cmd
this prompted me for my password
I then entered the password and the cmd window was launched
I navigated to "D:\Program Files\Microsoft Visual Studio 8\Common7\IDE>" (Installed in D drive) and tried
TF get $/myProject/Assets/UseCase
but got the error
Unable to determine the workspace.
Regards
Koshy75
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
One main point which I missed out was that the "tf get" option would work only if launched from the mapped directory (which SteveGTR pointed out to me)
This is what I eventually did:
==========================
Team Explorer (TFS) installed on D drive.
The path of tf.exe: "D:\Program Files\Microsoft Visual Studio 8\Common7\IDE\tf.exe"
Source control folder: "$/myProject"
Specific section of source control sub-folder to be retreived by the batch file: "$/myProject/Assets/Flow Diagrams"
Mapped local folder: "C:\My Files"
Destination path: "C:\My Files\Assets\Flow Diagrams"
1. First navigate to the mapped local folder
e.g. cd "c:\My Files\Assets\Flow Diagrams"
2. Execute tf.exe with the following options
"D:\Program Files\Microsoft Visual Studio 8\Common7\IDE\tf.exe" get "$/myProject/Assets/Flow Diagrams" /all /recursive /noprompt
Note:
There are multiple other options for "tf get" which you could choose based on your requirements.