Jump to content
Sign in to follow this  
sqa

How to change a directory?

Recommended Posts

sqa

Hi,

let say I have:

c:/Parent folder/

                         Folder 1

                                     start.au3

                         Folder 2

                                     run.exe

How can I navigate into run.exe folder without using in a script path 'c:/' part?

In this case the whole <Parent folder> can be used on different computers.

I can figure out a silly way doing it by checking @WorkingDir and extracting the path before <Parent folder>, that will be different for other computers, but this extracting thing tells me that there must be much better way.

Thanks

Share this post


Link to post
Share on other sites
jguinch

I think I understand your problem, but not sure..

If your runnig script is start.au3, and you want to access to run.exe, you can use a relative path from where you are.

For example, Run(@ScriptDir & "..folder2run.exe")

Is it right for you?

Share this post


Link to post
Share on other sites
TheSaint

Or ... Run(StringReplace(@ScriptDir, "Folder 1start.au3", "") & "Folder 2run.exe")

or spread that over two lines to look nicer (easier to read).


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Share this post


Link to post
Share on other sites
Chimp

I think I understand your problem, but not sure..

If your runnig script is start.au3, and you want to access to run.exe, you can use a relative path from where you are.

For example, Run(@ScriptDir & "..folder2run.exe")

Is it right for you?

 

there is not need of  @ScriptDir &

Run("..folder2run.exe") it is enough


small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×