The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Actions - Multiple Files + Spaces in file names

Tom “Bukowskaii” Bernens
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 1, 2024

I'm writing a series of .bat scripts to help with some git-lfs actions such as locking and unlocking files and viewing the currently locked files. 

I have successfully written three scripts, one to lock all, one to unlock all, and one to view locks. I now want to make 2 more, to lock/unlock the selected file(s) via the context menu. 

I have created a skeleton script, to pass the $FILE input to the bat so i can figure out its format. This script looks like this 

 

set ARG_NUM=0 
echo All Args: %*

for %%x in (%*) do (
set /A ARG_NUM+=1
echo Arg %ARG_NUM%: "%%x"
)

echo Number of Files: %ARG_NUM%

 

I have created a custom action called "Lock File(s)" and set it up like this

Screenshot 2024-08-01 161420.png

However, when I have spaces in file names, the arg passer treats the space as the delimiter, resulting in the file paths/names being sliced apart.

Screenshot 2024-08-01 161638.png

When I try to wrap ${FILE} in double quotes (input looks like "$FILE") only the first selected file is passed into the script.

Screenshot 2024-08-01 161742.png

What is the correct procedure for escaping the values selected in $FILE in order to pass them to another function or script?

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Emelia Linda
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 12, 2024

I am also facing same issue, we want to integrate it in our POS Terminal software and was facing issues

TAGS
AUG Leaders

Atlassian Community Events