You want to remove administrator privileges from the BAT that you performed with administrator privileges.

Asked 2 years ago, Updated 2 years ago, 69 views

Purpose

I want to launch another executable file from a BAT file that I ran with administrator privileges without granting administrator privileges.

Hoge.bat

@ECHO OFF
START NOTepad
exit

If you run Hoge.bat with administrator privileges, Notepad will also be granted administrator privileges, so I would like to stop it.I would appreciate it if you could let me know if you could use PowerShell or an external tool.

powershell batch-file

2022-09-30 11:44

1 Answers

If you specify 0x2000 as the trustlevel option in RUNAS, it appears that you can execute the command with general user privileges.

runas/trustlevel:0x20000 execution command


2022-09-30 11:44

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.