Adam Singer

Veni, vidi, expertus sum- I came, I saw, I tested

Remapping in style

James introduced me to a neat trick recently with working folders. Oftentimes, I create a workspace and only want to map one team project to the local workspace root. Of course, I could use the UI, but that’s not scriptable from a command file. I could also explicitly unmap the root and then remap. However, this requires the remap to indicate both workspace name and server name like so:

h workspace /new /noprompt /server:TfsCentral AdamWorkspace
h workfold /unmap $/
h workfold /map $/Project1 . /workspace:AdamWorkspace /server:TfsCentral

Instead of all this, we can simply remap over the current folder, ‘automagically’ deleting the old mapping. Moreover, if none of /map, /unmap, /cloak, /decloak are specified, the workfold command assumes /map. So, we could simply do this:

h workspace /new /noprompt /server:TfsCentral AdamWorkspace
h workfold $/Project1 .

Now, when I switch servers, I only have to update the server name in the workspace creation line of my command file. Thanks, James!