Home > front end >  Is there any way to create a sourcecode file with only one click at File Explorer?
Is there any way to create a sourcecode file with only one click at File Explorer?

Time:02-20

I always make a source code file by creating a 'new.txt' file then changing its extension. like this: create 'new.txt' -> then, change its name to 'new.c'

But I don't wanna do this every time. Is there any method to create 'new.c' with one easy click, from windows FILE EXPLORER?

CodePudding user response:

Yes, you can write a program that creates and opens an empty file, like this:

cd yourpath
type nul > new.c
Notepad "main.c"

Replace yourpath with the path where you intend to store your file to.

Save this file named to something like createfile.bat. Drag & Drop it to your favored place and then you can double-click it to create your file and open it. The problem you will face at the second use is that the file's name is unchanged. So, you will need to somehow make your filename unique, like adding a timestamp to its end or the like.

CodePudding user response:

Extending the New Submenu.

Assuming you already have .c files associated with a text editor you can just import this .reg file into the registry:

REGEDIT4

[HKEY_CURRENT_USER\Software\Classes\.c\ShellNew]
"NullFile"=""
  • Related