Can you set working directory to one level up in a easy way? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
peter_ahk
Posts: 117
Joined: 13 Feb 2024, 14:49

Can you set working directory to one level up in a easy way?

20 Apr 2024, 17:35

hello

i am looking for an easy way to set my working directory one level up from where it is

i have a tool in tools i want to work on the settings folder
my structure is like this (folders)

Tools
Settings
and here my main program exe that accesses bolth directories

so i run my batch tool from inside tools but want it to work on the settings folder, right now my tool is in the settings folder but it dont belong in there so i wonder if this can be done easily also for people who have zero knowledge of ahk in other words automaticly
TAC109
Posts: 1118
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: Can you set working directory to one level up in a easy way?  Topic is solved

20 Apr 2024, 20:35

The .. syntax in a path takes you up one directory, so if your current directory is Tools then the following code will take you to the Settings directory:

Code: Select all

SetWorkingDir ..\Settings
Cheers
My scripts:-
XRef - Produces Cross Reference lists for scripts
ReClip - A Text Reformatting and Clip Management utility
ScriptGuard - Protects Compiled Scripts from Decompilation
I also maintain Ahk2Exe
peter_ahk
Posts: 117
Joined: 13 Feb 2024, 14:49

Re: Can you set working directory to one level up in a easy way?

20 Apr 2024, 23:50

TAC109 wrote:
20 Apr 2024, 20:35
The .. syntax in a path takes you up one directory, so if your current directory is Tools then the following code will take you to the Settings directory:

Code: Select all

SetWorkingDir ..\Settings
Cheers
awesome thank you

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: gongnl and 98 guests