Page 1 of 1

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

Posted: 20.01.2020, 20:52
by stephen147
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:
W:\SS_CAD

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:

Image

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

Posted: 22.01.2020, 21:27
by Marek
CMD as admin with current path:

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

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

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

Posted: 22.01.2020, 22:43
by stephen147
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.

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

Posted: 23.01.2020, 21:02
by Marek
Additional if you want change the font color:

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

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

Posted: 23.01.2020, 21:11
by stephen147
Cool! Purple. One of my favourite colours...

Thanks!