Ask a Question

How to run a bat file with a relative path?

SOLVED
TestedOrange
Occasional Contributor

How to run a bat file with a relative path?

Hi,

 

I wonder how can I run a bat file from a relative path?

 

Our Testsuite is located in a git repository which results in different absolute paths per user.

Our folder structure looks like:

root

root/Scripts/MyBat.bat

root/TestComplete/suite.pjs

root/TestComplete/suite/foo.mds

etc.

 

I'd like to run the root/Scripts/MyBat.bat out of a keyword in root/TestComplete/suite/KeywordTests/

 

How can I achieve this without using an absolut path to MyBat.bat ?

 

Thank you and kind Regards

TestedOrange

5 REPLIES 5
TanyaYatskovska
SmartBear Alumni (Retired)

Hi @TestedOrange,

 

You need to play with ..\ or %CD%

 

It's mostly a question to system admins

---------
Tanya Yatskovskaya
SmartBear Community and Education Manager



I'd go with @TanyaYatskovska 's suggestion.  It's probably the easiest to implement.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
TanyaYatskovska
SmartBear Alumni (Retired)

Hi @TestedOrange,

 

Did you find the solution to the issue? Please share what you decided to use finally.

---------
Tanya Yatskovskaya
SmartBear Community and Education Manager



Thanks for your feedback.

 

I solved it by writing a routine using aqFileSystem.GetCurrentFolder() and aqFileSystem.GetFolderInfo().ParentFolder.

TanyaYatskovska
SmartBear Alumni (Retired)

Great to hear that the issue is resolved. And thanks for sharing it with us!

---------
Tanya Yatskovskaya
SmartBear Community and Education Manager



cancel
Showing results for 
Search instead for 
Did you mean: