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: 

Issue with Custom Action calling Explorer in Windows

Nick Henry
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!
October 17, 2017

I made a batch file that calls c:\windows\explorer.exe with parameters

 

The script works fine, but even if the batch file only contains:

`explorer`

Source tree indicates: 'Completed with errors, see above.'

 

To recreate:

Create custom action

Set 'Script to run' to the batch file to be ran

In the batch file have one line command `explorer`

Set Parameters to `$REPO $FILE`

 

Here's my actual script I'm trying to run: (ExploreRepoFilePath.bat)

ECHO OFF
SET FullPath=%1\%2
SET DirectoryPath=%~dp2
if exist %FullPath% (
c:\windows\explorer.exe /select,%FullPath:/=\%
exit
)
if exist %DirectoryPath% (
c:\windows\explorer.exe %DirectoryPath%
exit
)

c:\windows\explorer.exe %1

EXIT /B 0

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

2 votes
Answer accepted
Mike Corsaro
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 18, 2017

Hello! This is actually a problem in your script. You have the "EXIT /B 0" at the end of the file, but you don't return exit code 0 for the other 2 exits. Sourcetree uses the exit code to determine if it's successful or not. The fixed script should look like this:

 

ECHO OFF
SET FullPath=%1\%2
SET DirectoryPath=%~dp2
if exist %FullPath% (
c:\windows\explorer.exe /select,%FullPath:/=\%
EXIT 0
)
if exist %DirectoryPath% (
c:\windows\explorer.exe %DirectoryPath%
EXIT 0
)

c:\windows\explorer.exe %1

EXIT /B 0
Nick Henry
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!
October 18, 2017

Thanks Mike, I didn't think about that, figured it was something with calling Explorer specifically.

 

It's totally working now with no errors! thanks again.

TAGS
AUG Leaders

Atlassian Community Events