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

ShellException(setx a b /M, exitCode 1, workingDirectory #102

Open
laterdayi opened this issue Jan 15, 2024 · 3 comments
Open

ShellException(setx a b /M, exitCode 1, workingDirectory #102

laterdayi opened this issue Jan 15, 2024 · 3 comments

Comments

@laterdayi
Copy link

 var shell = Shell();

await shell.run('''
setx a b /M
''');
@alextekartik
Copy link
Contributor

It would help investigation if could add more info (such as which platform, I guess here Windows) and what kind of error (stdout/stderr) you get.

If I try on the command line:

PS C:\Users\Alex> setx a b /M
ERROR: Access to the registry path is denied.

Same if I try in dart code

await run('setx a b');
await run('setx a b /M');

It displays:

$ setx a b
SUCCESS: Specified value was saved.
$ setx a b /M
ERROR: Access to the registry path is denied.

So I guess the error is normal here since it requires elevated rights.

@laterdayi
Copy link
Author

@alextekartik

How to elevate permissions through dart or process_run to ensure that they can be executed

@alextekartik
Copy link
Contributor

Unfortunately I don't know how to raise permission but I guess a solution could be found like for other languages (java, node, .net): https://stackoverflow.com/questions/57106543/i-want-to-run-powershell-as-admin-and-execute-a-command-in-the-admin-power-shell

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