Question
· Mar 3, 2022

How to run a shell command with admin privileges from InterSystems terminal?

Hello dear community

I tried to run windows command from an intersystems terminal using objectscript routine.

routine :

Zpipe  quit ; CPIPE example to run host console command
cmd(command="",test=0) ;
 if command="" set command="dir"
 quit $$execute(command,test) execute(cmd,test) Public {
 set dev="|CPIPE|1"
 set $zt="cls"
 set empty=0
 open dev:cmd:0
 write:test $test,!
 else  write "pipe failed",! quit 0
 while empty<3 {
    use dev read line 
    set empty=$s($l(line):0,1:$i(empty))
    use 0 write line,! ;;; or do any kind of analysis of the line
    } cls ;
 set $zt="" use 0
 close dev 
 if $ze'["<ENDOFFILE>" w $ze,!
 quit $t
 }

 In InterSystems terminal: 

do cmd^pipe("cmd /c ""cd /d E:\repos\twilio-video-app-react && call npm run build""")

When i run the command directly in windows shell with admin privileges it works.

The routine runs the command without admin privileges and that causes error: 

question:

Is there way to add admin privileges to intersystems?

Thanks!

Discussion (1)0
Log in or sign up to continue