Execute batch script with admin rights in windows 8.1 by exec()


I am trying to run a batch file from php with exec() but it is not working. When I run the same script in a command window in admin mode the script works.

Now I want to know how can I configure in php that my script can be execute with ADMIN mode.


You can use <a href="http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/runas.mspx?mfr=true" rel="nofollow">RunAs Command</a>. Since it will ask admin password and you are running it from web you should pipe the admin password to the command.

exec('echo adminpassword | runas /user:administrator fullPathToProgram',$output); print_r($output);


  • Windows batch string manipulation in loop
  • Is it possible to make imports depend on the location of my Lua script instead of the current direct
  • Why is django manage.py syncdb failing to create new columns on my development server?
  • runtime error when linking ffmpeg libraries in qt creator
  • in batch how do i use taskkill properly
  • Changing Jupyter Notebook start up folder by modifying “start in” not working any more
  • Configure nginx to return different files to different authenticated users with the same URI
  • How do I retrieve the user information of a user authenticated with Apache's mod_ldap?
  • Getting media player state in windows phone 7
  • How to override value that appears in a dropdown in the rails_admin gem
  • How to specify input and output paths from cmd.exe for a PowerShell script?
  • Security issues with PHP's Readfile method
  • How do I configure context broker accept post requests from my remote sensor?
  • onBackPressed() not being executed
  • How do I get HTML corresponding to current DOM tree?
  • Alert pop up with LWUIT
  • Disabling Alt-F4 on a Win Forms NotifyIcon
  • Jenkins: How To Build multiple projects from a TFS repository?
  • How do I fake an specific browser client when using Java's Net library?
  • swift auto completion not working in Xcode6-Beta
  • How to recover from a Spring Social ExpiredAuthorizationException
  • ILMerge & Keep Assembly Name
  • Perl system calls when running as another user using sudo
  • How to show dropdown in excel using jrxml (jasper api)?
  • Large data - storage and query
  • Delete MySQLi record without showing the id in the URL
  • Why winpcap requires both .lib and .dll to run?
  • Apache 2.4 - remove | delete | uninstall
  • WOWZA + RTMP + HTML5 Playback?
  • SVN: Merging two branches together
  • Hibernate gives error error as “Access to DialectResolutionInfo cannot be null when 'hibernate.
  • Run Powershell script from inside other Powershell script with dynamic redirection to file
  • AngularJs get employee from factory
  • Load html files in TinyMce
  • How can I get HTML syntax highlighting in my editor for CakePHP?
  • coudnt use logback because of log4j
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • Can Visual Studio XAML designer handle font family names with spaces as a resource?
  • Programmatically clearing map cache
  • How to get NHibernate ISession to cache entity not retrieved by primary key