[Solved] Ascend one directory in a hierarchy?

Discuss and share scripts and script files...
Post Reply
highend
Posts: 14940
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

[Solved] Ascend one directory in a hierarchy?

Post by highend »

Mh,

when I'm in a specific folder in a directory hierarchy, how do I get one hierarchy higher?

I can't use a full path (dir names will be random and I'm already in such a dir when the script is invoked) but
the ascending has to be done relative to the current dir.

e.g. I'm in: D:\Temp\foobar and I want the script to change the dir to D:\Temp

Code: Select all

goto "..\";
is bringing me back to the last directory before I switched (manually) to D:\Temp\foobar
(in this case D:\Users\Admin\Downloads)

Tia,
Highend
Last edited by highend on 07 Feb 2011 16:34, edited 1 time in total.
One of my scripts helped you out? Please donate via Paypal

zer0
Posts: 2676
Joined: 19 Jan 2009 20:11

Re: Ascend one directory in a hierarchy?

Post by zer0 »

You can use #523, which is a command for "Up" ;)
Reporting a bug? Have a wish? Got a question? Use search - View roadmap - FAQs: Forum + XY site
Windows 7/10
Always using the latest stable two-decimal build

Stefan
Posts: 1360
Joined: 18 Nov 2008 21:47
Location: Europe

Re: Ascend one directory in a hierarchy?

Post by Stefan »

highend wrote:when I'm in a specific folder in a directory hierarchy, how do I get one hierarchy higher?
[...]
e.g. I'm in: D:\Temp\foobar and I want the script to change the dir to D:\Temp

Code: Select all

goto "..\";
or
goto "<curpath>\..";

highend
Posts: 14940
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Ascend one directory in a hierarchy?

Post by highend »

Ok, script is working now.

Thank you zer0 & Stefan!
One of my scripts helped you out? Please donate via Paypal

Post Reply