Getting the Retrieving Current Working Directory Absolute Path

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
twosixfoursix
Posts: 6
Joined: 03 Jun 2023 07:22

Getting the Retrieving Current Working Directory Absolute Path

Post by twosixfoursix »

Hi there,

I hope this finds you well. I was wondering, is there a way we are able to get specifically the current working directory path & run a user defined command by passing that as argument? I seem to only be able to pass selected files paths within a folder - not the folder itself.

Currently, I am having to accomplish this via terrible code in the form of a proxy program that:
    1. Acts on any selected file and gets only the first file form arguments.
    2. Checks if it is a directory or actual file. If file, then retrieves its containing folder.
    3. Starts up a windows process using that gnarly Win32 API function.

I was hoping you could offer some solution to this issue so I could avoid the unsafe/poorly-written code just to open Windows Terminal at the current directory I am at...

The issue is that I am running Windows 10 & have disabled some OS features due to which I am unable to "set" my official Command Prompt exe to anything other than cmd.exe or powershell.exe - I run a portable mode of Windows Terminal for my CLI tasks. I did go through the site and help to see if this was possible, but wasn't able to find what I was looking for. I would greatly appreciate any suggestions/follow-up regarding the matter.

Thank you kindly,
Amin

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

Re: Getting the Retrieving Current Working Directory Absolute Path

Post by highend »

<curpath> contains the current path of the active list pane

So e.g.:

Code: Select all

$wt = "{path to your portable windows terminal ...}\wt.exe";
    run """$wt"" new-tab -d ""<curpath>""";
One of my scripts helped you out? Please donate via Paypal

twosixfoursix
Posts: 6
Joined: 03 Jun 2023 07:22

Re: Getting the Retrieving Current Working Directory Absolute Path

Post by twosixfoursix »

Absolutely amazing! Worked like a charm, much appreciated!

Post Reply