Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add run as admin argument for windows #45

Open
Fefedu973 opened this issue Oct 5, 2022 · 9 comments
Open

Add run as admin argument for windows #45

Fefedu973 opened this issue Oct 5, 2022 · 9 comments

Comments

@Fefedu973
Copy link

No description provided.

@newville
Copy link
Owner

newville commented Oct 5, 2022

@Fefedu973 Um, what? I think every Issue needs an actual description. I certainly cannot guess what you mean.

@Fefedu973
Copy link
Author

Sorry, but that's more of a feature request than a problem. In fact I would like to know if it was possible to add an option that would generate a shortcut that runs the program as administrator

@newville
Copy link
Owner

newville commented Oct 5, 2022

@Fefedu973. I do not how to do this from a python script that generates the shortcut on any platform! Do you know how to do that? If so, which platforms?

@Fefedu973
Copy link
Author

@Fefedu973. I do not how to do this from a python script that generates the shortcut on any platform! Do you know how to do that? If so, which platforms?

I have an hard coded workaround for windows

@newville
Copy link
Owner

newville commented Oct 5, 2022

@Fefedu973

I have an hard coded workaround for windows

How does that work? I was just looking at the "CreateShortcut" call, and I don't see an easy setting for that. Maybe there is some flag that I do not see or maybe it is one of those insane "completely normal" Windows tweaks?

@Fefedu973
Copy link
Author

Fefedu973 commented Oct 5, 2022

@Fefedu973

I have an hard coded workaround for windows

How does that work? I was just looking at the "CreateShortcut" call, and I don't see an easy setting for that. Maybe there is some flag that I do not see or maybe it is one of those insane "completely normal" Windows tweaks?

it edits a aleready existing shortcut

        filename = path to shortcut
        with open(filename, "rb") as f2:
            ba = bytearray(f2.read())
        ba[0x15] = ba[0x15] | 0x20
        with open(filename, "wb") as f3:
            f3.write(ba)

@newville
Copy link
Owner

newville commented Oct 5, 2022

@Fefedu973 OK, wow - "Worst Fears Realized"! Just get in there and start flipping bits around, what could possibly go wrong ;).

Do you have any documentation for that, like, maybe some Microsoft developer's guide?

@Fefedu973
Copy link
Author

@Fefedu973 OK, wow - "Worst Fears Realized"! Just get in there and start flipping bits around, what could possibly go wrong ;).

Do you have any documentation for that, like, maybe some Microsoft developer's guide?

I found this on stackoverflow and it worked

1 similar comment
@Fefedu973
Copy link
Author

@Fefedu973 OK, wow - "Worst Fears Realized"! Just get in there and start flipping bits around, what could possibly go wrong ;).

Do you have any documentation for that, like, maybe some Microsoft developer's guide?

I found this on stackoverflow and it worked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants