Batch - open with notepad + administrator

Open discussion about any topic, as long as you abide by the rules of course!
Post Reply
obsidian
Posts: 10974
Joined: Mon Feb 04, 2002 8:00 am

Batch - open with notepad + administrator

Post by obsidian »

I'm wondering if anyone knows how to execute a Windows batch file or other script that can open a configuration file in a text editor as an administrator.

I have a bunch of config files that need to be edited on a normal basis that are hidden deep in a bunch of subfolders protected from normal user access. It's really annoying running the text editor as administrator and then manually browsing through a dozon subfolders.

Thanks.
[size=85][url=http://gtkradiant.com]GtkRadiant[/url] | [url=http://q3map2.robotrenegade.com]Q3Map2[/url] | [url=http://q3map2.robotrenegade.com/docs/shader_manual/]Shader Manual[/url][/size]
4days
Posts: 5465
Joined: Tue Apr 16, 2002 7:00 am

Re: Batch - open with notepad + administrator

Post by 4days »

in a bit of a rush so don't have time to properly check/test any of this, but could you do something in the registry based on the file extension?

http://www.howtogeek.com/howto/windows- ... ows-vista/

..or put a shortcut in your shortcut - create a shortcut to the editor of your choice, then edit the shortcut properties to set the compatibility settings to always open as admin - then right-click on the type of file (again, this relies on the extension) and go to open with,.. choose the shortcut you just created rather than the editor itself. from then on i think it should automatically ask if you want to run as admin when you try to open one of those files. that may be bollocks, i just tested it by making a shortcut and then typing "start <shortcut name> <document path>" for notepad++ and it seemed to work fine.
bitWISE
Posts: 10704
Joined: Wed Dec 08, 1999 8:00 am

Re: Batch - open with notepad + administrator

Post by bitWISE »

You can't just do this and run it as admin?

Code: Select all

notepad /path.to/a.txt
notepad /path/to/this/b.txt
notepad /omg/wtf/bbq.txt
Also, if you have the option to install notepad++, it remembers the files you leave open so you could just launch it as admin and not close the child windows.
obsidian
Posts: 10974
Joined: Mon Feb 04, 2002 8:00 am

Re: Batch - open with notepad + administrator

Post by obsidian »

Oh, that works bitWISE. Thanks guys.
[size=85][url=http://gtkradiant.com]GtkRadiant[/url] | [url=http://q3map2.robotrenegade.com]Q3Map2[/url] | [url=http://q3map2.robotrenegade.com/docs/shader_manual/]Shader Manual[/url][/size]
User avatar
Transient
Posts: 11357
Joined: Fri Feb 09, 2001 8:00 am

Re: Batch - open with notepad + administrator

Post by Transient »

notepad++ is awesome like that. :up:
[quote="YourGrandpa"]I'm satisfied with voicing my opinion and moving on.[/quote]
Post Reply