mkfile is a powerful, lightweight PowerShell utility that streamlines file and directory creation. Whether you're scaffolding new projects, organizing directories, or automating workflows, mkfile eliminates repetitive manual file creation with a single command.
Perfect for developers, DevOps engineers, and anyone who spends time setting up file structures manually.
β
Create Single or Multiple Files - Add one file or dozens in a single command
β
Auto-Create Parent Directories - No more manual folder creation
β
Nested Path Support - Create deeply nested file structures instantly
β
Path Safety - Prevents accidental file creation outside your working directory
β
Simple & Intuitive - Minimal learning curve, maximum productivity
β
Cross-Friendly - Works with relative paths and complex directory structures
β
Lightweight - Zero dependencies, pure PowerShell
- Windows 10+ or Windows Server 2016+
- PowerShell 5.1+ (included by default on all supported Windows versions)
- Administrator Access (optional, depending on target directory permissions)
. .\mkfile.ps1# Single file
mkfile index.html
# Multiple files
mkfile index.html style.css script.js
# Nested structure (directories auto-created)
mkfile src/components/Button.tsx src/styles/Button.cssThat's it! Files are created instantly.
- Download
mkfile.ps1from this repository - Place it in your project directory
- Load it in your PowerShell session:
. .\mkfile.ps1Make mkfile available in every PowerShell session:
# Open your PowerShell profile
notepad $PROFILE
# Add this line to the file
. "C:\path\to\mkfile.ps1"
# Save and close
# Reload your profile
. $PROFILENow you can use mkfile from any directory!
- Save
mkfile.ps1to a permanent location (e.g.,C:\Scripts\) - Add that folder to your Windows PATH environment variable
- Create a shortcut batch file in your PowerShell scripts folder
mkfile [OPTIONS] <file_path> [<file_path2>] [<file_path3>]...mkfile README.md
mkfile index.html
mkfile config.jsonmkfile app.js style.css index.html manifest.json# Creates 'src' directory automatically
mkfile src/main.ts
mkfile src/index.tsx
# Creates nested directories
mkfile src/components/Button/Button.tsx
mkfile src/components/Button/Button.css
mkfile src/components/Button/index.tsmkfile src/App.tsx public/index.html docs/API.md config/settings.jsonmkfile -v
# Output: v1.1.0mkfile -i
# Output: mkfile: A PowerShell function to create files.
# Repository: https://github.com/mehedi-codes/mkfile
# Author: mehedi-codes
# Version: v1.1.0mkfile public/index.html `
src/App.tsx `
src/index.tsx `
src/App.css `
src/components/Header/Header.tsx `
src/components/Header/Header.css `
.env.local `
.gitignore `
README.mdmkfile src/server.js `
src/routes/api.js `
src/middleware/auth.js `
src/config/database.js `
tests/server.test.js `
.env `
.env.example `
package.jsonmkfile docs/Getting-Started.md `
docs/API/Authentication.md `
docs/API/Users.md `
docs/API/Products.md `
docs/CONTRIBUTING.mdmkfile src/__init__.py `
src/main.py `
src/utils/helpers.py `
tests/test_main.py `
requirements.txt `
README.md `
.gitignoreIf a directory in the path doesn't exist, mkfile creates it automatically:
mkfile very/deeply/nested/structure/file.txt
# Creates all directories if they don't exist
# Output: Directory 'C:\...\very\deeply\nested\structure' created.
# File 'C:\...\very\deeply\nested\structure\file.txt' created successfully.If a file already exists, mkfile skips it gracefully:
mkfile existing_file.txt
# Output: File 'C:\path\to\existing_file.txt' already exists.mkfile provides clear error messages:
mkfile ../../../outside/project/file.txt
# Output: Error: Target path is outside the current working directory.- Path Containment: mkfile prevents creation of files outside the current working directory
- Safe Permissions: Respects Windows file permissions
- No Elevation Required: Works within user permissions (unless accessing restricted directories)
- Error Reporting: Clear feedback on what went wrong
Found a bug? Have a feature request? We'd love your help!
- Report an Issue
- Submit a Pull Request
- Check out open issues for ways to contribute
- Questions? Open a GitHub Discussion
- Bug Report? Create an Issue
- Feature Request? Let us know in Discussions
| Feature | mkfile | mkdir -p | New-Item |
|---|---|---|---|
| Create Files | β | β | β |
| Auto-Create Dirs | β | β | β |
| Multiple Files | β | β | |
| Ease of Use | βββββ | ββ | βββ |
| Speed | βββββ | ββββ | βββ |
v1.1.0 (Current)
- Improved error handling
- Better directory creation logic
- Enhanced path safety
- Cleaner output messages
This project is provided as-is for community use. See the repository for more details.