Sign in to follow this  
Followers 0
blitzer99

Current folder name?

3 posts in this topic

Does anyone know how to obtain the name of the current folder in which an autoit script is being run? (both the fully qualified name and the name of the current level only: for example "c:\program files\abc corporation\myapp" in the case of the former and just "myapp" in the case of the latter).

I have looked up all the functions, macros and user add-ons but I cannot see how to obtain this information.


Computers don't solve problems, they just rearrange them.New string TRIM() functions for AutoIt3

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hmm.... The macros to try would be

@ScriptDir

or

@WorkingDir

MsgBox(4096,"Example", "The script is running from folder " & @ScriptDir)

Edit: For just the current folder level, you could try http://www.autoitscript.com/fileman/users/Valik/path.au3 or maybe

$p = StringSplit(@ScriptDir,"\")
MsgBox(4096,"folder", $p[$p[0]] )

OR if using the latest unstable version of Autoit

$q = StringTrimLeft(@ScriptDir, StringInStr(@ScriptDir, "\", 0, -1))
MsgBox(4096,"folder", $q)
Edited by CyberSlug

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post


Link to post
Share on other sites

Great! Many thanks. Exactly what I was looking for.

I was looking in the AutoIt3 documentation under "Macro Reference / Directory Macros" where neither of these macros is shown. :( I have now found them under AutoIt related macros. :ph34r:


Computers don't solve problems, they just rearrange them.New string TRIM() functions for AutoIt3

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  
Followers 0