Anonymous ex-Microsoft coder on what it's like to work on Windows 10
-
@flabdablet said in Anonymous ex-Microsoft coder on what it's like to work on Windows 10:
@Tsaukpaetra said in Anonymous ex-Microsoft coder on what it's like to work on Windows 10:
Mine's a bit more fancy
Yeah, so's mine; I just pared it down to the bare essentials to illustrate the fundamental mechanism.
Eh, no sweat on my back. My snip is drag-n-drop friendly,ready for blind implementation, yours would require a bit of intelligence to ensure correct implementation.
....
I Probably shouldn't post to SO, based on that...
-
@Tsaukpaetra said in Anonymous ex-Microsoft coder on what it's like to work on Windows 10:
drag-n-drop friendly,ready for blind implementation
Anybody who does this with cmd scripts is asking for hours of pain.
-
@anotherusername you can't, in the sense of "you can't run a console elevated inside of a non-elevated console, so all your output will be in another console window that pops on demand"
-
@sloosecannon that wasn't really what I meant. I meant "if you have a non-elevated command prompt, how do you run an application as admin and have it elevated". The batch scripts that @flabdablet and @Tsaukpaetra posted (well, it's basically the same script) demonstrate that it can be done, although only if you can create a temporary file and run a .vbs.
-
@anotherusername said in Anonymous ex-Microsoft coder on what it's like to work on Windows 10:
only if you can create a temporary file and run a .vbs.
Yeah, I was trying to figure out how to get cscript to accept its script input from stdin, but didn't get very far.
-
@Tsaukpaetra Can't be done with cmd AFAIK. WSH isn't built to do that by itself, and cmd doesn't have any of the bashisms that let you turn a pre-opened handle into a command line argument.
You could invoke cscript.exe from bash and provide it with a here doc. Then again, bash actually implements here docs and here strings by creating temp files anyway.