AzCopy in Batch file
Asked Answered
O

1

5

Am trying to copy files to Azure Blob using AzCopy.

When execute AzCopy at command line it works fine, but executing same through .bat file getting issues.

ex: azcopy copy "c:\xxxxxxx\20210304" "https://xxxx.blob.core.windows.net/xxxxxxxdrop?sp=rw&st=2021-03-04T05:06:45Z&se=2021-03-04T13:06:45Z&spr=https&sv=2020-02-10&sr=c&sig=xxxxxxxxxxxxxxxxxxxoqxx6dJczN26Mc%3D" --recursive

what is the best way to achieve this

Overtire answered 4/3, 2021 at 5:14 Comment(0)
D
10

Some special characters in .bat file should be escaped. In the command you provided, the % in the sas_token should be replaced by %%.

If the issue is that the azcopy command cannot be found, you should specify the full path of the azcopy.exe in your .bat file.

I gave it a try at my side, it works fine in .bat file. Here is the screenshot:

enter image description here

By the way, here is an issue about chars-escape in .bat file.

Discoverer answered 4/3, 2021 at 6:44 Comment(1)
Thanks Ivan!! same issue i was facing, your solution worked for meNotarize

© 2022 - 2024 — McMap. All rights reserved.