Notepad in WinBatch System folder

Started by rw_baker, January 29, 2016, 03:43:24 AM

Previous topic - Next topic

rw_baker

I'm using: Windows 10 - Winbatch 2015B - Running as Administrator
When I'm in the WinBatch system folder:  Using Notepad - I can't save an altered text file,
however, if I use Studio, I can save an altered text file.
Could you suggest changes which will allow me to use Notepad in WinBatch System folder?
I have not found a solution in searching the database.
Thanks,

RW Baker

td

MSFT incorporated UAC into the Windows operating system with the release of Windows Vista back in 2007.  It has been a part of Windows ever since.   This means that by default administrators do not have full administrator privileges unless they elevate to full admin privileges when prompted via a consent or credentials dialog displayed on a secure desktop.   On Vista and Windows 7 you could turn this behavior off and always run with full admin privileges by setting the UAC slider to 'Never notify' in the UAC commandlet.  However, as of Windows 8, using that setting does not turn off UAC.  It turns off the prompt but does not allow admins to automatically run with full admin privileges.  On Windows 8 and newer with UAC set to 'Never notify', the OS will run programs with restricted privileges unless the programs are manifested to run with elevated privileges.  So when an executable is manifested to run with elevated privileges, the program is started by an admin and the system is set to 'Never notify'; it will automatically run with full admin privileges; otherwise, it will run with restricted privileges.  If the system is set to use UAC prompting, a consent or credentials prompt is displayed when the program is manifested to run with full admin privileges.

By default on Windows systems, the Program Files and Program Files (x86) folders require full admin privileges to modify files in any of the sub folders under these two folders.  Notepad is not manifested to run as with administrative privileges so by default it cannot modify and save changes to files in an sub folder under the Program Files and Program Files (x86) folders.  However, WinBatch Studio.exe is manifested to run with highest available privileges so it will have full admin privileges when executed by an administrator and be able to edit and save files in those folders.

So your problem has very little to do with WinBatch and a great deal to do with Windows.  There are multiple ways to start a program with full admin privileges on Windows 10.  One of the simplest is to navigate to the executable using File Explorer, right-click on the executable file, and select the 'Run as Administrator' menu item.


   
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

Russell_Williams

You are trying to edit a file in the c:\program files type folder, which is restricted by Windows (not Winbatch).
Since you run 2015B as an administrator, you have rights to edit files in the Program Files folder.
But when you run Notepad, you aren't running it as administrator, so Windows properly prevents you from editing those same files.

You will need to right click on the c:\windows\notepad.exe and run that as administrator to get the same results as 2015B.
Or you could start Notepad from a cmd prompt which you ran as administrator first.
Or you could change your station so everything runs as administrator (not recommended).

rw_baker

Thanks to both of you for taking a little time to formulate such complete and educational responses!

I've been editing "System" files in WinBatch with Notepad since 2001...how the time flies when you are "sinning"!
Win 5->Win XP->Win 7->Win 10...to get the old feeling, I've just edited a file with "Run as administrator"...so, back
to Studio.

RW Baker