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

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

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

#1 Post by stephen147 » 20.01.2020, 19:52

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
Last edited by stephen147 on 22.01.2020, 21:46, edited 1 time in total.
Sceenshots made easy with ShareX.

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

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

#2 Post by Marek » 22.01.2020, 20:27

CMD as admin with current path:

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

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

stephen147
Posts: 243
Joined: 18.10.2015, 14:44

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

#3 Post by stephen147 » 22.01.2020, 21:43

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.
Sceenshots made easy with ShareX.

Marek
Author
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

#4 Post by Marek » 23.01.2020, 20:02

Additional if you want change the font color:

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

stephen147
Posts: 243
Joined: 18.10.2015, 14:44

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

#5 Post by stephen147 » 23.01.2020, 20:11

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

Thanks!
Sceenshots made easy with ShareX.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests