Command Prompt Shortcut

User avatar
Bigaldoc
PlatinumLounger
Posts: 3757
Joined: 24 Jan 2010, 11:00
Location: Lexington, KY, USA

Command Prompt Shortcut

Post by Bigaldoc »

In Win XP I have a shortcut on my desktop for the command prompt simply because it's quicker than using the run command. In that shortcut, on the "WORKING" box, I have a C:\ to get the prompt at the root.

In Win 7 the box is now called "START IN" and the C:\ doesn't happen.

Any idea why?

User avatar
HansV
Administrator
Posts: 78489
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Command Prompt Shortcut

Post by HansV »

Are you sure? I created a shortcut to cmd.exe and entered C:\ in the Start In: box. The command prompt window does start with C:\ as initial folder:
x853.png
You do not have the required permissions to view the files attached to this post.
Best wishes,
Hans

User avatar
Bigaldoc
PlatinumLounger
Posts: 3757
Joined: 24 Jan 2010, 11:00
Location: Lexington, KY, USA

Re: Command Prompt Shortcut

Post by Bigaldoc »

Yeah, I'm positive. I've been messin' with it since last evening. Maybe it was the manner in which I created the shortcut. I'll keep plugging now that I know it works for you. Thanks...

User avatar
Bigaldoc
PlatinumLounger
Posts: 3757
Joined: 24 Jan 2010, 11:00
Location: Lexington, KY, USA

Re: Command Prompt Shortcut

Post by Bigaldoc »

Well, in a manner of speaking, you're correct Hans, BUT...

I created a new shortcut and did as your example and lo and behold, it works as you showed. BUT it will not allow me to run a CHKDSK unless I "run as administrator." When I do that, it will no longer open to the C:\ root but rather to the System32 folder instead. So, I guess I'll have to live with it because the major reason I use the command prompt is for my weekly CHKDSK prior to my full image backup, which is running on my desktop as I write.

It also uncovered another little bit of confusion for me. There are two places one can choose to "Run as administrator."

If I choose it in the context menu of the shortcut, shown here, that will not allow me to run CHKDSK and I don't understand what's different between this choice and the one in the next example:
2011-11-27_160912.png
This one is "inside" the properties of the shortcut, under an Advanced button and it does allow me to run CHKDSK after the usual UAC prompt which is understandable:
2011-11-27_161106.png
You do not have the required permissions to view the files attached to this post.

User avatar
HansV
Administrator
Posts: 78489
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Command Prompt Shortcut

Post by HansV »

Apparently, having an elevated command prompt start in C:\Windows\System32 regardless of what is specified in "Start in" is intended as a visual reminder. As far as I can tell, you cannot change this. But perhaps someone else will come up with a clever suggestion.
Best wishes,
Hans

User avatar
Bigaldoc
PlatinumLounger
Posts: 3757
Joined: 24 Jan 2010, 11:00
Location: Lexington, KY, USA

Re: Command Prompt Shortcut

Post by Bigaldoc »

This concerns my post above (two graphics) about the two different methods of running a program as an administrator.

According to this link, the first method I show is supposed to allow running as an administrator ONCE ONLY, that is, it's not sticky. However where the command prompt is concerned, it will NOT allow me to run CHKDSK.

Again according to this writeup, the second method WILL allow the "run as admin" to be sticky and it DOES allow me to run CHKDSK.

I think it's a very confusing proposition and I wish MS hadn't done it this way.

Run as Administrator - Windows 7 Forums

User avatar
HansV
Administrator
Posts: 78489
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Command Prompt Shortcut

Post by HansV »

Once again, my experience is different. When I right-click a "normal" shortcut to Command Prompt and select Run As Administrator, I get a UAC prompt, and if I click Yes, I can run chkdsk from the command prompt window that opens...
Best wishes,
Hans

JoeP
SilverLounger
Posts: 2069
Joined: 25 Jan 2010, 02:12

Re: Command Prompt Shortcut

Post by JoeP »

See if the first answer at Windows 7 admin command prompt "start in" path helps.

Joe
Joe

User avatar
Bigaldoc
PlatinumLounger
Posts: 3757
Joined: 24 Jan 2010, 11:00
Location: Lexington, KY, USA

Re: Command Prompt Shortcut

Post by Bigaldoc »

Thanks Joe. Worth a shot. I tried /k "c:\" which didn't work. I didn't think to try CD.

User avatar
DaveA
GoldLounger
Posts: 2599
Joined: 24 Jan 2010, 15:26
Location: Olympia, WA

Re: Command Prompt Shortcut

Post by DaveA »

Al,
The second method is normally applied to the "exe" file and therefore will always be opened with the "Run as" rule. But, every time you open this exe file, UAC will kick in will give you the "Mother may I?" question!

There are some programs that need to be set this way, as they need to be run as administrator every time.

Have you tried setting the exe of "CHKDSK" in this manner and made a link to it?

Edit, I use very few Icons, I normally just use "Windows Key+ R" and that open the run window, and is a lot faster than trying to find a icon.
I am so far behind, I think I am First :evilgrin:
Genealogy....confusing the dead and annoying the living

User avatar
Bigaldoc
PlatinumLounger
Posts: 3757
Joined: 24 Jan 2010, 11:00
Location: Lexington, KY, USA

Re: Command Prompt Shortcut

Post by Bigaldoc »

Thanks, Dave. I don't mind the UAC prompt. I just didn't understand why the two locations of "Run as administrator" seemed to function differently. I have yet to re-check after what Hans said yesterday.

I guess you may be right - I should put a shortcut to CHKDSK on my desktop since it's 99% of why I use the command prompt. I might give that a try too. If one does that, I don't know if it will open a window or just run silently.

PS: I use the Desktop Toolbar (next to the tray) so it's the only reason I have icons on my desktop. It's very easy to find and execute all the stuff I need from that toolbar.

User avatar
DaveA
GoldLounger
Posts: 2599
Joined: 24 Jan 2010, 15:26
Location: Olympia, WA

Re: Command Prompt Shortcut

Post by DaveA »

Just tried the Chkdsk shortcut and it did not work for me.
I think one needs to make a shortcut to the "Cmd" prompt that is set to Run as Administrator and then type in CHKDSK.
I am so far behind, I think I am First :evilgrin:
Genealogy....confusing the dead and annoying the living

User avatar
Bigaldoc
PlatinumLounger
Posts: 3757
Joined: 24 Jan 2010, 11:00
Location: Lexington, KY, USA

Re: Command Prompt Shortcut

Post by Bigaldoc »

Thanks Dave. Save me the trouble of doing it too.

CMD is my shortcut, so I've already done that.

User avatar
Bigaldoc
PlatinumLounger
Posts: 3757
Joined: 24 Jan 2010, 11:00
Location: Lexington, KY, USA

Re: Command Prompt Shortcut

Post by Bigaldoc »

JoeP wrote:See if the first answer at Windows 7 admin command prompt "start in" path helps.
Oh yeah Joe, that answers it alright. Not only that, but the last answer on that page taught me that the ampersand (&) is used on the command line to add more than one parameter. So, just for grins, here's the command line in my desktop shortcut and it works:
    • C:\Windows\system32\cmd.exe /k "cd c:\" & title Big Al's Command Prompt
(PS: The icon is also of my selection.)
You do not have the required permissions to view the files attached to this post.

User avatar
HansV
Administrator
Posts: 78489
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Command Prompt Shortcut

Post by HansV »

Thanks - that nicely concludes this thread.
Best wishes,
Hans