Skip to content

A tool that lets you create empty files on the fly wherever you want.

License

Notifications You must be signed in to change notification settings

hmz777/New-File-Tool

Repository files navigation

GitHub GitHub release (latest by date) GitHub Release Date GitHub last commit

New File Tool

Basically, this is a tool that lets you create empty files on the fly wherever you want.

Why?

Well I always find myself creating .bat and .ps1 files that aren't present in the New Context menu and adding every file that I want to the menu using the registry ShellNew key was ugly so I created this tool.

How?

The app uses Pinvoke to grab the Active Windows Explorer window you're working in, get the path that is open in it, and set it as the path that you'll be creating paths relative to. If it doesn't find an Active "explorer.exe" window, it creates your file on the desktop directory.

Features

  • The app registers a System-wide Hot Key (L-Shift + Q), a combination of keys that when pressed can activate the app and bring it to the topmost.
  • Can create full paths, not just files i.e, "dir\file.txt" creates a directory with the name "dir" and "file.txt" inside it.
  • You can add file attribute flags so you can mark the file as hidden, system, or readonly. Something like this: \dir1\dir2\file.txt > -h -s -r.
  • If you don't have an active "explorer.exe" window or you're in a special system folder like the root directory "This PC" or "Recycle Bin" the app creates your file on the desktop directory.
  • The app starts minimized with a tray icon and can be brought to the front via the tray context menu with the "Show" button or via the defined HotKey.

Binaries

Download NewFileTool

Notes

Most of the code that you'll see in this repository is from Pinvoke and StackOverflow. I only stitched them together and added some code of my own to create this tool.

Development Notes

This project references the following COM libraries:

  • Microsoft Shell Controls And Automation
  • Microsoft Internet Controls

You don't have to reference them, I only did it to expose the Shell, ShellWindows, and InternetExplorer types in the Tools Class for IntelliSense purposes only, you can just leave them as dynamic and compile. See here.

Upcoming Features

  • I will be adding file attribute flags so you can mark the file as hidden, system, or readonly. Something like this: \dir1\dir2\file.txt > -h -s -r Done! ✅
  • An option for entering absolute paths instead of relative ones.

Author

Hamzi Alsheikh

Website: https://www.hamzialsheikh.tk