0

I'm creating a simple batch file that uses Azure REST API to download data from a blob. If I type the request directly into the command prompt, it works perfectly and my data appears in the directory. However, when I run it as a batch file, it does not work and I can see in the command line that some characters from the blob connection string (acts as an access token) have been dropped. I cannot share the full access token, but can show that the drop happens at the end of the connection string, in what is known as the signature:

correct: "...5U%2BJgo%3D"

batch file output: "...5UBJgoD"

It appears the issue is with special characters and some numbers. There are no other special characters in the signature and other numbers in the rest of the signature are not affected.

Other notes:

  • The connection string is indeed entered within a "" string
  • I tried forcing the encoding to UTF-8 encoding by running chcp 65001 before the request line executes; didn't work
double-beep
  • 5,031
  • 17
  • 33
  • 41
Ryan
  • 227
  • 1
  • 3
  • 11
  • 1
    The percent symbol is a special character. It is used for variable expansion. To escape a percent symbol you double the percent symbol. – Squashman Nov 29 '18 at 15:42
  • 1
    especially here, `%2` is the second parameter to your batch file and `%3` the third one. Both obviously empty (no parameters to the batch file) – Stephan Nov 29 '18 at 15:45

1 Answers1

2

You should escape your percent sign (%) with double-percent sign (%%). For example you should type:

"...5U%%2BJgo%%3D"

It is quite useful to search in the internet before you post here, on Stack OverFlow. So, check the links provided:

Hope this helps!

double-beep
  • 5,031
  • 17
  • 33
  • 41