Jump to content

How to change a directory?


sqa
 Share

Recommended Posts

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

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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

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

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

Link to comment
Share on other sites

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

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...