Windows: update custom software installed on Program FilesHow can I get my NSIS context menu options back...
Is there a math equivalent to the conditional ternary operator?
Is there any relevance to Thor getting his hair cut other than comedic value?
A bug in Excel? Conditional formatting for marking duplicates also highlights unique value
Are all UTXOs locked by an address spent in a transaction?
When was drinking water recognized as crucial in marathon running?
Why do phishing e-mails use faked e-mail addresses instead of the real one?
Why doesn't "adolescent" take any articles in "listen to adolescent agonising"?
Called into a meeting and told we are being made redundant (laid off) and "not to share outside". Can I tell my partner?
How do we objectively assess if a dialogue sounds unnatural or cringy?
Did Amazon pay $0 in taxes last year?
Create chunks from an array
Where is the fallacy here?
How to mitigate "bandwagon attacking" from players?
I encountered my boss during an on-site interview at another company. Should I bring it up when seeing him next time?
How to fix my table, centering of columns
Split a number into equal parts given the number of parts
Is there a way to find out the age of climbing ropes?
Should we avoid writing fiction about historical events without extensive research?
Plagiarism of code by other PhD student
Sometimes a banana is just a banana
PTIJ: Mordechai mourning
is 'sed' thread safe
PTIJ: Why can't I sing about soda on certain days?
What is better: yes / no radio, or simple checkbox?
Windows: update custom software installed on Program Files
How can I get my NSIS context menu options back after associating a program with .NSI files?Issues with Windows 8 UsersHow to know the path of the MSI or EXE from which a software program was installedWill a 64 bit software have a poor performance if it's installed in Program Files (x86)?Allow specific windows applications to update from user account with no local administrator rightsinstalled Software VersionWindows Update stalls in fresh W7 install after W10 upgrade. and more thingsAdding Media Transfer Protocol Device (MTP Device) support for Windows 10 NDisable installation permission popup for my installerWhat does Windows.old folder contain?
Im the developer of a Windows software application which I currently release as "portable", meaning the user needs to extract it somewhere into his disk. Along with it I ship a small update tool (external app / python script converted into an .exe through pyinstaller) that handles updates as follows:
- Main app calls the update tool in the background and quits
- Update tool runs: fetches new files, removes files in the main app directory and extract new ones (the new main app .exe, dlls, and
other files that might be required) - Update tool call main app again
Questions: by creating an installer (NSIS / InnoSetup) and letting the user to install the app in Program Files, will I be able to keep this update tool? I mean, can it have enought permissions to do the update like that? If not, how can/should the updates be done?
windows installer nsis
New contributor
add a comment |
Im the developer of a Windows software application which I currently release as "portable", meaning the user needs to extract it somewhere into his disk. Along with it I ship a small update tool (external app / python script converted into an .exe through pyinstaller) that handles updates as follows:
- Main app calls the update tool in the background and quits
- Update tool runs: fetches new files, removes files in the main app directory and extract new ones (the new main app .exe, dlls, and
other files that might be required) - Update tool call main app again
Questions: by creating an installer (NSIS / InnoSetup) and letting the user to install the app in Program Files, will I be able to keep this update tool? I mean, can it have enought permissions to do the update like that? If not, how can/should the updates be done?
windows installer nsis
New contributor
add a comment |
Im the developer of a Windows software application which I currently release as "portable", meaning the user needs to extract it somewhere into his disk. Along with it I ship a small update tool (external app / python script converted into an .exe through pyinstaller) that handles updates as follows:
- Main app calls the update tool in the background and quits
- Update tool runs: fetches new files, removes files in the main app directory and extract new ones (the new main app .exe, dlls, and
other files that might be required) - Update tool call main app again
Questions: by creating an installer (NSIS / InnoSetup) and letting the user to install the app in Program Files, will I be able to keep this update tool? I mean, can it have enought permissions to do the update like that? If not, how can/should the updates be done?
windows installer nsis
New contributor
Im the developer of a Windows software application which I currently release as "portable", meaning the user needs to extract it somewhere into his disk. Along with it I ship a small update tool (external app / python script converted into an .exe through pyinstaller) that handles updates as follows:
- Main app calls the update tool in the background and quits
- Update tool runs: fetches new files, removes files in the main app directory and extract new ones (the new main app .exe, dlls, and
other files that might be required) - Update tool call main app again
Questions: by creating an installer (NSIS / InnoSetup) and letting the user to install the app in Program Files, will I be able to keep this update tool? I mean, can it have enought permissions to do the update like that? If not, how can/should the updates be done?
windows installer nsis
windows installer nsis
New contributor
New contributor
New contributor
asked yesterday
msrmsr
1061
1061
New contributor
New contributor
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
It sounds like you just need to have the updater app be able to elevate privileges.
I found the following gist here:
https://gist.github.com/GaryLee/d1cf2089c3a515691919
import sys
import ctypes
def run_as_admin(argv=None, debug=False):
shell32 = ctypes.windll.shell32
if argv is None and shell32.IsUserAnAdmin():
return True
if argv is None:
argv = sys.argv
if hasattr(sys, '_MEIPASS'):
# Support pyinstaller wrapped program.
arguments = map(unicode, argv[1:])
else:
arguments = map(unicode, argv)
argument_line = u' '.join(arguments)
executable = unicode(sys.executable)
if debug:
print 'Command line: ', executable, argument_line
ret = shell32.ShellExecuteW(None, u"runas", executable, argument_line, None, 1)
if int(ret) <= 32:
return False
return None
if __name__ == '__main__':
ret = run_as_admin()
if ret is True:
print 'I have admin privilege.'
raw_input('Press ENTER to exit.')
elif ret is None:
print 'I am elevating to admin privilege.'
raw_input('Press ENTER to exit.')
else:
print 'Error(ret=%d): cannot elevate privilege.' % (ret, )
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
msr is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1411535%2fwindows-update-custom-software-installed-on-program-files%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
It sounds like you just need to have the updater app be able to elevate privileges.
I found the following gist here:
https://gist.github.com/GaryLee/d1cf2089c3a515691919
import sys
import ctypes
def run_as_admin(argv=None, debug=False):
shell32 = ctypes.windll.shell32
if argv is None and shell32.IsUserAnAdmin():
return True
if argv is None:
argv = sys.argv
if hasattr(sys, '_MEIPASS'):
# Support pyinstaller wrapped program.
arguments = map(unicode, argv[1:])
else:
arguments = map(unicode, argv)
argument_line = u' '.join(arguments)
executable = unicode(sys.executable)
if debug:
print 'Command line: ', executable, argument_line
ret = shell32.ShellExecuteW(None, u"runas", executable, argument_line, None, 1)
if int(ret) <= 32:
return False
return None
if __name__ == '__main__':
ret = run_as_admin()
if ret is True:
print 'I have admin privilege.'
raw_input('Press ENTER to exit.')
elif ret is None:
print 'I am elevating to admin privilege.'
raw_input('Press ENTER to exit.')
else:
print 'Error(ret=%d): cannot elevate privilege.' % (ret, )
add a comment |
It sounds like you just need to have the updater app be able to elevate privileges.
I found the following gist here:
https://gist.github.com/GaryLee/d1cf2089c3a515691919
import sys
import ctypes
def run_as_admin(argv=None, debug=False):
shell32 = ctypes.windll.shell32
if argv is None and shell32.IsUserAnAdmin():
return True
if argv is None:
argv = sys.argv
if hasattr(sys, '_MEIPASS'):
# Support pyinstaller wrapped program.
arguments = map(unicode, argv[1:])
else:
arguments = map(unicode, argv)
argument_line = u' '.join(arguments)
executable = unicode(sys.executable)
if debug:
print 'Command line: ', executable, argument_line
ret = shell32.ShellExecuteW(None, u"runas", executable, argument_line, None, 1)
if int(ret) <= 32:
return False
return None
if __name__ == '__main__':
ret = run_as_admin()
if ret is True:
print 'I have admin privilege.'
raw_input('Press ENTER to exit.')
elif ret is None:
print 'I am elevating to admin privilege.'
raw_input('Press ENTER to exit.')
else:
print 'Error(ret=%d): cannot elevate privilege.' % (ret, )
add a comment |
It sounds like you just need to have the updater app be able to elevate privileges.
I found the following gist here:
https://gist.github.com/GaryLee/d1cf2089c3a515691919
import sys
import ctypes
def run_as_admin(argv=None, debug=False):
shell32 = ctypes.windll.shell32
if argv is None and shell32.IsUserAnAdmin():
return True
if argv is None:
argv = sys.argv
if hasattr(sys, '_MEIPASS'):
# Support pyinstaller wrapped program.
arguments = map(unicode, argv[1:])
else:
arguments = map(unicode, argv)
argument_line = u' '.join(arguments)
executable = unicode(sys.executable)
if debug:
print 'Command line: ', executable, argument_line
ret = shell32.ShellExecuteW(None, u"runas", executable, argument_line, None, 1)
if int(ret) <= 32:
return False
return None
if __name__ == '__main__':
ret = run_as_admin()
if ret is True:
print 'I have admin privilege.'
raw_input('Press ENTER to exit.')
elif ret is None:
print 'I am elevating to admin privilege.'
raw_input('Press ENTER to exit.')
else:
print 'Error(ret=%d): cannot elevate privilege.' % (ret, )
It sounds like you just need to have the updater app be able to elevate privileges.
I found the following gist here:
https://gist.github.com/GaryLee/d1cf2089c3a515691919
import sys
import ctypes
def run_as_admin(argv=None, debug=False):
shell32 = ctypes.windll.shell32
if argv is None and shell32.IsUserAnAdmin():
return True
if argv is None:
argv = sys.argv
if hasattr(sys, '_MEIPASS'):
# Support pyinstaller wrapped program.
arguments = map(unicode, argv[1:])
else:
arguments = map(unicode, argv)
argument_line = u' '.join(arguments)
executable = unicode(sys.executable)
if debug:
print 'Command line: ', executable, argument_line
ret = shell32.ShellExecuteW(None, u"runas", executable, argument_line, None, 1)
if int(ret) <= 32:
return False
return None
if __name__ == '__main__':
ret = run_as_admin()
if ret is True:
print 'I have admin privilege.'
raw_input('Press ENTER to exit.')
elif ret is None:
print 'I am elevating to admin privilege.'
raw_input('Press ENTER to exit.')
else:
print 'Error(ret=%d): cannot elevate privilege.' % (ret, )
answered yesterday
Eddie DunnEddie Dunn
56626
56626
add a comment |
add a comment |
msr is a new contributor. Be nice, and check out our Code of Conduct.
msr is a new contributor. Be nice, and check out our Code of Conduct.
msr is a new contributor. Be nice, and check out our Code of Conduct.
msr is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1411535%2fwindows-update-custom-software-installed-on-program-files%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown