Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- REM Three files follow
- REM RunAsAdminConsole.bat
- REM This file compiles RunAsAdminconsole.vb to RunAsAdminconsole.exe using the system VB.NET compiler.
- REM Runs a command elevated using a manifest
- C:\Windows\Microsoft.NET\Framework\v4.0.30319\vbc "%~dp0\RunAsAdminconsole.vb" /win32manifest:"%~dp0\RunAsAdmin.manifest" /out:"%~dp0\RunAsAdminConsole.exe" /target:exe
- REM To use
- rem RunAsAdminconsole <Command to run>
- pause
- ----------------------------------------
- RunAsAdmin.manifest
- <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
- <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
- <assemblyIdentity
- version="1.0.0.0"
- processorArchitecture="*"
- name="Color Management"
- type="win32"
- />
- <description>Serenity's Editor</description>
- <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
- <security>
- <requestedPrivileges>
- <requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>
- </requestedPrivileges>
- </security>
- </trustInfo>
- </assembly>
- ----------------------------------------
- 'RunAsAdminConsole.vb
- 'Change cmd /k to cmd /c to elevate and run command then exit elevation
- imports System.Runtime.InteropServices
- Public Module MyApplication
- Public Sub Main ()
- Dim wshshell as object
- WshShell = CreateObject("WScript.Shell")
- Shell("cmd /k " & Command())
- End Sub
- End Module
- ----------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement