Search code examples
phpcom

Open MyComputer using PHP COM class


i'm trying to open MyComputer using COM class ... whould you help me with the name of MyComputer in COM class ?? For example , if you wanna open NotePad you do this :

<?php
$shell = new COM("WScript.Shell");
$shell->Run("notepad.exe");
$shell = null; ?>

Run("notepad.exe"); works for notepad , but when i use Run("mycomputer.exe"); i face error :

Fatal error: Uncaught exception 'com_exception' with message 'Source: Unknown
Description: Unknown' in E:\Localhost\root\test.php:3 Stack trace: #0 E:\Localhost\root\test.php(3): com->Run('computer.exe') #1 {main} thrown in E:\Localhost\root\test.php on line 3

i appreciate any help from you my dear friends <3


Solution

  • you can try :

    <?php
    $shell = new COM("WScript.Shell");
    $shell->Run("explorer.exe ,");
    $shell = null; ?>
    

    when we add "," it open My computer.