Admin Priviledges on Windows

How do I run a script with admin priviledges on Windows? My tests require running sudo npm run test essentially.

1 Like

I am having the same issue and looking for a solution as well. Any @jafri luck on getting it to work? Is there a way for us to pass shell commands to an elevated instance? @josh

Here is an attempt at running cross-platform tests for python 3.4-3.7.
https://travis-ci.org/guzman-raphael/travis-python-test/builds/530257386?utm_source=github_status&utm_medium=notification

Windows builds should already be running with admin privileges. I’m not sure of the exact error you’re facing without a build log, but I’d imagine Windows doesn’t have a “sudo” command.

That failed due to:

/c/Users/travis/.travis/functions: line 104: python3: command not found

Assuming Chocolatey updated the system PATH (in the Registry) to include the directory containing the python3 program, you’ll need to reload that PATH using RefreshEnv.cmd like:

cmd //c "RefreshEnv.cmd & pip3 install --user --upgrade pip || pip3 install --upgrade pip"

Note that you’ll need this manoeuvre via cmd.exe for every successive command, since RefreshEnv.cmd is a batch script that can only load the PATH into its process. The proposed RefreshEnv for bash will make this a one-time . (source) operation.

Imprint