Giter VIP home page Giter VIP logo

Comments (9)

mh-cbon avatar mh-cbon commented on June 6, 2024 1

might it be of any help,
https://github.com/ChristopherHaws/node-windows-elevate
https://github.com/mh-cbon/aghfabsowecwn

from node-windows.

coreybutler avatar coreybutler commented on June 6, 2024

Yes, I believe it's a silent command in its current form. I don't have time to test it, but I believe a few minor changes to bin/elevate/elevate.vbs will provide the output you're looking for. Specifically, using CScript instead of WScript. I honestly don't remember why I didn't do this in the original version, but here is what I think it would need to look like:

Set Shell = CreateObject("Shell.Application")
Set WShell = CScript.CreateObject("CScript.Shell")
Set ProcEnv = WShell.Environment("PROCESS")

cmd = ProcEnv("CMD")
app = ProcEnv("APP")
args= Right(cmd,(Len(cmd)-Len(app)))

If (CScript.Arguments.Count >= 1) Then
  Shell.ShellExecute app, args, "", "runas", 0
Else
  CScript.Quit
End If

Please let me know if that helps, and I'm sorry I can't test things out right now.

from node-windows.

endquote avatar endquote commented on June 6, 2024

Hey, thanks for checking it out. I tried that but I get the error Object required: 'CScript'. I researched this a bit and got as far as changing start wscript to start cscript in elevate.cmd, but that just popped up a console window briefly and didn't actually elevate the command.

I'm not really familiar with Windows scripting (aside from batch files...) so I'm unsure what to try next, but if you want me to check something out I'd be glad to. This also isn't a critical bug for me right now, so no big deal if it sits around a while. Thanks again for the great tool.

from node-windows.

jviotti avatar jviotti commented on June 6, 2024

Having the same issue here. I can't tell if the elevation was successful or not (error is null in any case), or if the child process was successful or not (not sure if there is something analogous to UNIX error codes on Windows).

Is this feasible? I have no experience on Windows system myself to work on this.

from node-windows.

jviotti avatar jviotti commented on June 6, 2024

@coreybutler I've been trying to get your suggestion working. I made use of CScript along the code and call it with start cscript as @endquote suggestion.

The following line turned out to be problematic:

Set WShell = CScript.CreateObject("CScript.Shell")

and it returned an error that said: "Microsoft VBScript runtime error: Object required: "CScript"" (the error is shown in a terminal instance that is shown for a few milliseconds, so I had to film to screen and pick the right frame in order to see it, but there is still a missing part of the error that is not visible due to the small terminal size).

After some googling, I replaced CScript.CreateObject with simply CreateObject, but I now get the following error:

Microsoft VBScript runtime error: ActiveX component can't create object: 'CScript.Shell'.

I'd appreciate is someone with experience on this can provide some feedback.

from node-windows.

coreybutler avatar coreybutler commented on June 6, 2024

@jviotti - which version of Windows are you running this on?

I haven't had much time for fixes on this project recently and have been re-evaluating the elevation process for the next version.

from node-windows.

jviotti avatar jviotti commented on June 6, 2024

@coreybutler I'm running Windows 8.1, please let me know of any news regarding this issue.

from node-windows.

jakub-g avatar jakub-g commented on June 6, 2024

@coreybutler first of al, thanks for this module, it's very neat 👍
+1 from me, would be really cool if I could tell if the elevation succeded.

AFAIU what happens now is if the user clicks 'no' in UAC prompt, Windows will do some some kind of emulation pretending that it can write to disk (this is my use case) but will not really do it - will not throw any EPERM errors as would happen when running without elevation, which can be a bit misleading.

(my use case for the usage of this module is creating symlinks which apparently is impossible from regular non-elevated node scripts)

from node-windows.

black-snow avatar black-snow commented on June 6, 2024

elevate() pops up tha UAC but doesn't do anything other than that. Win10 @32bit

from node-windows.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.