Windows cmd scripts to change hosts permissions #43
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I created two windows cmd scripts that can work together to change permissions for
the current user to modify the hosts file.
the first script
win-hosts-check.cmd
checks if the permissions on the file are sufficient. It can be called from it's directory.If not it will call the second script
win-hosts-set.cmd
which will trigger the windowspermission dialog asking for enough rights to modify the permissions on
the hosts file for the current user.
See issue #40
Note 1: As those are supporting files I didin't know where to place them. So I create the
cmd
subdirectory. I don't know the correct convetions for those vagrant plugins with those.Note 2: The principle on linux if the permissions are not enough is to sudo out a sed command. Those two script are not aligned with such a principle. Instead those work idempotent and the first script only needs to be called as it will take care to set permissions only if necessary.