c# - Create index.php file in directory -


i want write program added right-click menu , when run program right-click menu create index.php file in current directory!

exmaple:

  • i go c:\wamp\www

  • then right-click somewhere , want choose create index.php

  • this should create new file called index.php in directory clicked

desired action:

a new file called index.php wil created @ c:\wamp\www\index.php

more details:

i want make "text document" in "new":

right-click => new => text document

when click windows create "new text document.txt" ... want when click on program windows create "index.php" file!

registry path program operate within it:

hkey_classes_root\directory\background\shell\

thanks ...

have @ this:

using system; using system.io;  namespace createindex_php {     class program     {         static void main(string[] args)         {             string path = string.empty;             try             {                 if (file.exists(args[0])) // right clicked on file in explorer                 {                     path = path.getdirectoryname(args[0]);                 }                 else                 {                     path = args[0];                 }             }             catch (exception ex)             {                 console.writeline(string.format(@"error while creating ""index.php"": {0}", ex.message));                 console.readkey();             }              if (path != string.empty)             {                 path = path.combine(path, "index.php");                 try                 {                     file.create(path);                     console.writeline(@"""index.php"" created!");                     console.readkey();                 }                 catch (exception ex)                 {                     console.writeline(string.format(@"error while creating ""index.php"": {0}", ex.message));                     console.readkey();                 }             }         }     } } 

this creation of index.php file.

anyway, have subscribe app right click menu using regedit , go following key:

hkey_classes_root\*\shellex\contextmenuhandlers 

please see following links that:


Comments

Popular posts from this blog

Email notification in google apps script -

c++ - Difference between pre and post decrement in recursive function argument -

javascript - IE11 incompatibility with jQuery's 'readonly'? -