Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I created a shortcuts for my mostly used applications such as notepad, sublime etc.. So everytime I have to create and edit a file I just type %notepad% filename.txt, this conveniently opens notepad.exe and asks me if I want to create a file called filename.txt. It makes it feel like I am using ubuntu :D

How ever I find it annoying to type % everytime I want to use this. Is there a way I could maybe create a shortcut for this too ?

Also once in command prompt how do I elevate myself to admin ? Like in ubuntu I type sudo to do this.

share|improve this question
    
Just don't use the %. Typing notepad filename.txt performs the behavior you describe above for me. Also, to run a program as a different user, use the runas command. Simply type runas /help for more information. However, I generally prefer to simply right-click on the command prompt shortcut, and select "Run as Administrator," as @Slowki mentioned before. –  Bobort Dec 17 '13 at 22:41
    
I seem to have changed a setting somewhere I guess cause neither runas works nor does the notepad filename.txt directly ! Both of them return the standard "the command is not recognized as internal or a external command" –  Aditya Dec 17 '13 at 23:48
    
Ever since I uninstalled cygwin I am not able to use runas command as well as run notepad as command. I get the standard " Command not recognized as internal or external command" –  Aditya Dec 17 '13 at 23:56
    
@Aditya if you open a cmd.exe and type set path do you see %systemroot% in the variable? If so, your variables are messed up and you need to change your registry. (You need to change the path type from reg_sz to reg_expand_sz.) Let us know if that's the case and we'll tell you where to find the key. –  Rik Dec 18 '13 at 0:06
1  
@Aditya Wow, your path setting in the registry is ok (no %systemroot%) but your path itself is really screwed up. I don't see the C:\Windows and C:\Windows\System32 at all. Clean Windows 7 has default path %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\Syst‌​em32\WindowsPowerShell\v1.0\ . You might want to add these to the beginning of your system-path in the environment dialog. After that your notepad textfile.txt will work again. Like so. –  Rik Dec 18 '13 at 9:46

2 Answers 2

up vote 0 down vote accepted

To get admin priveleges(As far as I know) you have to actually right click and press run as administrator.
To run commands like notepad SlowkiIsAwesome.txt the easiest method is to setup aliases, this guide Create an alias in Windows XP should work, even in Win7

share|improve this answer
    
ever since I uninstalled cygwin I am not able to use alias in dos prompt. could you please repost your earlier reply which you edited out I guess. It was about creating a user function or something. –  Aditya Dec 17 '13 at 23:54

You can create a folder, stuff it with batch scripts that do whatever you want, and add the new folder's location to the PATH environment variable (with SetX). This way, when ever you run something from CMD or Run, they'll search first in your folder too.

If you don't want to create a new folder, then you can just put your batch files in a folder that's already in PATH environment variable.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.