workaround to avoid "unknown publisher" warning popup
Sunday, October 2nd, 2011 06:56 pmI have a text editor program on my computer, and every time I opened the program, I was getting a UAC (User Account Control) warning popup, "Do you want to allow the following program from an unknown publisher to make changes to your computer?". Along with a warning noise and darkening of the screen. As I used the program often, getting that each time was quite annoying.
I read that changing the User Account Control settings to "Never Notify" would prevent the warning popup. But I only want to prevent the warning for this program, not *all* programs. So I didn't make that change.
I read that installing the program to somewhere other than the "Program Files" folder might avoid the issue. So I tried that, but it did not prevent the popup.
Another page suggested installing the offending program under the "Users" folder. So I tried that, but it did not prevent the popup.
This page explains how to set up a task in Task Scheduler, in order to run a program with highest privileges, to avoid the warning. This method *does* work to prevent the warning popup.
However, I have an entry in my Windows Explorer context menu (which I added via the registry), which allows me to right-click on files and open them with my text editor. This passes the selected file-name and path as a parameter to the text editor. When setting up my task in the Task Scheduler, I couldn't find any way to pass the parameter to my program.
I finally came up with the following workaround, to be able to open files from Windows Explorer using my text editor, without getting the warning popup.
In Brief:
The context menu command calls Batch File #1.
Batch File #1 saves the filename to a text file and invokes the Task.
The Task is set up to invoke Batch File #2 (with elevated privileges).
Batch File #2 reads the filename from the text file, and invokes the text editor along with the filename parameter.
Rather than writing/reading the filename to a text file, I first tried saving it in an environment variable. But I couldn't get that to work, so I used the text file instead.
The Details:
My Registry has an entry like this:
HKCR\*\shell\OpenEditor\command
with this string value:
C:\bat\startEditor.bat "%1"
The "startEditor.bat" batch file contains this:
echo %1* > C:\bat\startEditor_file.txt
C:\Windows\System32\schtasks.exe /run /tn "RunEditor"
In Task Scheduler, I have a task named "RunEditor" which performs the following command:
C:\bat\startEditor2.bat
The "startEditor2.bat" batch file contains this:
FOR /F "delims=*" %%I IN (C:\bat\startEditor_file.txt) DO SET file2open=%%I
start "" C:\PROGRA~2\editorFolder\editorProgram.exe %file2open%
The first batch file writes out the filename followed by an asterisk, to the text file.
The "FOR" statement in the 2nd batch file reads the filename from the text file. The default delimiter is a space, which would be a problem if the filename contains spaces. So I overrode the delimiter to be an asterisk instead (which is why the first batch file writes out the asterisk).
Yay! for Microsoft protecting me so exceedingly well from unknown publishers, that I have to go through all this trouble to avoid those pesky warning messages. /sarcasm
I read that changing the User Account Control settings to "Never Notify" would prevent the warning popup. But I only want to prevent the warning for this program, not *all* programs. So I didn't make that change.
I read that installing the program to somewhere other than the "Program Files" folder might avoid the issue. So I tried that, but it did not prevent the popup.
Another page suggested installing the offending program under the "Users" folder. So I tried that, but it did not prevent the popup.
This page explains how to set up a task in Task Scheduler, in order to run a program with highest privileges, to avoid the warning. This method *does* work to prevent the warning popup.
However, I have an entry in my Windows Explorer context menu (which I added via the registry), which allows me to right-click on files and open them with my text editor. This passes the selected file-name and path as a parameter to the text editor. When setting up my task in the Task Scheduler, I couldn't find any way to pass the parameter to my program.
I finally came up with the following workaround, to be able to open files from Windows Explorer using my text editor, without getting the warning popup.
In Brief:
The context menu command calls Batch File #1.
Batch File #1 saves the filename to a text file and invokes the Task.
The Task is set up to invoke Batch File #2 (with elevated privileges).
Batch File #2 reads the filename from the text file, and invokes the text editor along with the filename parameter.
Rather than writing/reading the filename to a text file, I first tried saving it in an environment variable. But I couldn't get that to work, so I used the text file instead.
The Details:
My Registry has an entry like this:
HKCR\*\shell\OpenEditor\command
with this string value:
C:\bat\startEditor.bat "%1"
The "startEditor.bat" batch file contains this:
echo %1* > C:\bat\startEditor_file.txt
C:\Windows\System32\schtasks.exe /run /tn "RunEditor"
In Task Scheduler, I have a task named "RunEditor" which performs the following command:
C:\bat\startEditor2.bat
The "startEditor2.bat" batch file contains this:
FOR /F "delims=*" %%I IN (C:\bat\startEditor_file.txt) DO SET file2open=%%I
start "" C:\PROGRA~2\editorFolder\editorProgram.exe %file2open%
The first batch file writes out the filename followed by an asterisk, to the text file.
The "FOR" statement in the 2nd batch file reads the filename from the text file. The default delimiter is a space, which would be a problem if the filename contains spaces. So I overrode the delimiter to be an asterisk instead (which is why the first batch file writes out the asterisk).
Yay! for Microsoft protecting me so exceedingly well from unknown publishers, that I have to go through all this trouble to avoid those pesky warning messages. /sarcasm