RESOLVED: Option to run the cmd with the current folderpath as admin

Bugs and other issues or requests which have been resolved.
Message
Author
stephen147
Posts: 240
Joined: 18.10.2015, 14:44

RESOLVED: Option to run the cmd with the current folderpath as admin

There was a new addition to the lasted FC to allow running tools as.
viewtopic.php?f=20&t=10159

Here's a question I put in the general section of the forum on how I tried to run cmd as admin in the current folder.
The cmd command that I posted here doesn't still work when I uncheck the run as and then the new option right-click run as.

It still starts in the C:\Windows\system32 folder.

----

If I go to create my own batch file to open in the current folder this happens when I'm navigated to this directory:

When I check the Enclose each selected item with " it closes the cmd window if run as admin which I think would fix the problem
See this simple batch file code:

Code: Select all

``````%~d1
cd "%~1"
SET var="%cd%"
ECHO %var%
pause
``````
It returns this:

Code: Select all

``````"W:\SS_CAD"
Press any key to continue . . .``````
But if I navigate to the next folder which has spaces (W:\SS_CAD\AutoCAD Blocks Library) I get this output:

Code: Select all

``````The system cannot find the path specified.
"W:\"
Press any key to continue . . .``````
My settings for the toolbar item:

Last edited by stephen147 on 22.01.2020, 21:46, edited 1 time in total.

Marek
Author
Posts: 2685
Joined: 10.04.2006, 07:48
Location: Germany
Contact:

Re: Option to run the cmd with the current folderpath as admin

CMD as admin with current path:

Program or folder: %windir%\system32\cmd.exe

Parameter: /k "cd /d %ActivDir%"

stephen147
Posts: 240
Joined: 18.10.2015, 14:44

Re: Option to run the cmd with the current folderpath as admin

Thank you, Marek!

It was just that easy!! I'll post that on the other thread I started in the general section should anyone want that.

Marek
Author
Posts: 2685
Joined: 10.04.2006, 07:48
Location: Germany
Contact:

Re: RESOLVED: Option to run the cmd with the current folderpath as admin

Additional if you want change the font color:

Parameter: /k "cd /d %ActivDir% && COLOR 0D"

stephen147
Posts: 240
Joined: 18.10.2015, 14:44

Re: RESOLVED: Option to run the cmd with the current folderpath as admin

Cool! Purple. One of my favourite colours...

Thanks!