Douglas Farias Expert Licensed User Longtime User Sep 8, 2016 #1 Hi all. how can i check if a file is runing as administrator? on my .jar i m opening a another .exe file, not made in b4j, i need open this .exe with administrator rights the same of click with right mouse button and select run as administrator. how can i run or check administrator on b4j (shell)? thx
Hi all. how can i check if a file is runing as administrator? on my .jar i m opening a another .exe file, not made in b4j, i need open this .exe with administrator rights the same of click with right mouse button and select run as administrator. how can i run or check administrator on b4j (shell)? thx
Erel B4X founder Staff member Licensed User Longtime User Sep 8, 2016 #2 Are you starting the other exe file with jShell? It will run with administrator privileges if the B4J process runs as administrator. You can use this code (on Windows) to test whether the process has administrator privileges: Code: Sub RunningAsAdministrator As Boolean Try File.WriteString("\", "test.txt", "test") File.Delete("\", "test.txt") Return True Catch Return False End Try End Sub Upvote 0
Are you starting the other exe file with jShell? It will run with administrator privileges if the B4J process runs as administrator. You can use this code (on Windows) to test whether the process has administrator privileges: Code: Sub RunningAsAdministrator As Boolean Try File.WriteString("\", "test.txt", "test") File.Delete("\", "test.txt") Return True Catch Return False End Try End Sub