-
Notifications
You must be signed in to change notification settings - Fork 2
Cmder open in directory
FFMG edited this page Jan 26, 2018
·
1 revision
- Create a Lua script
- Add the code below
** Edit the path to your commander
local cmderPath = [[Path\to\your\Cmder.exe]];
- Save it in your rootcommand folder.
-- the location of the cmder.exe if it is not in the path.
local cmderPath = [[.\Cmder.exe]];
-- do we have a folder?
local thisFolder = am_getfolder( 0, false );
-- if we don't have a folder, guess what we are looking for.
if thisFolder == false then
local sizeOf = am_getCommandCount();
if sizeOf == 0 then
-- no arguments.
am_say( "<i>Going to <b>home</b> drive</i>.", 400, 10 )
am_execute( cmderPath, [[/START %HOMEDRIVE%\]], true );
else
local thisWord = am_getCommand( 1 );
if thisWord == "home" or thisWord == "h" then
am_say( "<i>Going to <b>home</b> drive</i>.", 400, 10 )
am_execute( cmderPath, [[/START %HOMEDRIVE%\]], true );
elseif thisWord == "system" or thisWord == "s" then
am_say( "<i>Going to <b>system</b> drive</i>.", 400, 10 )
am_execute( cmderPath, [[/START %SYSTEMDRIVE%\]], true );
else
am_execute( cmderPath, "", true );
end
end
else
-- go to the selected folder and in case of multiple drives, change the drive letter.
am_say( "<i>Going to <b>".. thisFolder .."</b></i>.", 400, 10 )
am_execute( cmderPath, "/START \"" .. thisFolder .. "\"", true);
end