0

I am using microsoft tfs command line client. Its CLC zip is obtained from here.
My zip is = TEE-CLC-14.134.0. Extracted in dir = C:\mstfscmdclient

Issue - Whenever TFS user password has double quotes in them, tf commands fail.
Example -

call mstfscmdclient\tf.cmd workspaces /collection:<my tfs server url> /login:<my tfs username>,<my tfs password>

This command fails when passwords are with double quotes like Abcd@"2018, Abc"&<=2018 etc.
Same command works when passwords are without double quotes like Abcd@2018'', A~``$%^&<=@18b etc.
Error -

An error occurred: Access denied connecting to TFS server <my tfs server url> (Authenticating as <my tfs username>)


Please note that I must use CLC client only and must execute TFS operations using tf.cmd only. This is approved at my org level and cant be changed. So, solutions from Visual Studio, tf.exe etc tools are not useful for me.

I have gone through following official documentation but did not get details about password policies or any limitations.
[ Azure DevOps & TFS / Azure Repos / TFVC / Reference / TFVC command reference / Use Team Foundation version control commands]
and [ Docs / Previous Versions / Visual Studio / Team Foundation Version Control Command-Line Reference / Tf Command-Line Utility Commands]

Edit 2 - This question is not duplicate of Escaping special characters in cmd.
Many passwords are not working with the solution proposed in it.
For eg - Year<"%^&*2018 did not work when called tf.cmd with "Year<""%^&*2018", "Year<""%^&&*2018", "Year<""%^^&&*2018", "Year<""%%^^&&*2018".

jessehouwing
  • 106,458
  • 22
  • 256
  • 341
Haripriya
  • 822
  • 1
  • 14
  • 27
  • Did you try to put "\" before the quotes? `Abcd@\"2018, Abc\"&<=2018"` – Shayki Abramczyk Dec 05 '18 at 10:00
  • @ShaykiAbramczyk Yes, I tried with \ and ^ and %. None of them worked. – Haripriya Dec 05 '18 at 10:05
  • Did you try doubling up `"zkhxkchvjk""dkfhkdfk"` the quotes? – jessehouwing Dec 05 '18 at 10:09
  • @jessehouwing Doubling quotes did not work. I have updated my question. It is not duplicate. – Haripriya Dec 05 '18 at 11:45
  • See the escape list here: https://www.robvanderwoude.com/escapechars.php and it may be different if you're using a PowerShell console instead of a traditional console. – jessehouwing Dec 05 '18 at 12:05
  • And possibly try: http://output.jsbin.com/anitaz/11 – jessehouwing Dec 05 '18 at 12:08
  • @jessehouwing https://www.robvanderwoude.com/escapechars.php is for escaping, i did refer to it but its not useful in my case as i dont want to escape characters in my password. Tried escaped CMD strings received from http://output.jsbin.com/anitaz/11; that did not work either; same error from tf.cmd as described above. – Haripriya Dec 05 '18 at 13:11
  • 1
    It looks like the variables are passed along as a variable set `java -Xmx2048M -cp %CLC_CLASSPATH% %TF_ADDITIONAL_JAVA_ARGS% "-Dcom.microsoft.tfs.jni.native.base-directory=%BASE_DIRECTORY%native" com.microsoft.tfs.client.clc.vc.Main %*`, chances ae you need to double escape your password. You are looking for the correct escape sequence and this may be considered a bug in tf-clc. – jessehouwing Dec 05 '18 at 14:07
  • @jessehouwing Thing is tf commands work properly from user systems without /login flag; as soon as we append /login to tf commands, above cases start failing on client systems as well as on central system. If this is really a bug then I think I should publish a note for our org users to avoid double-quotes in their passwords. Thanks for help :) – Haripriya Dec 06 '18 at 06:34

0 Answers0