"Create new empty file" function

English support forum

Moderators: Hacker, petermad, Stefan2, white

User avatar
DoctorDDL
Junior Member
Junior Member
Posts: 3
Joined: 2007-06-14, 09:56 UTC
Location: Belgrade, Serbia

"Create new empty file" function

Post by *DoctorDDL »

TC has a lot of integrated functions but strangely enough, it doesn't have a very simple function for creating a new empty file.

At the moment, if I want to create a new empty file, I have to use an external application, like Notepad or Notepad++. Problem with this is that, when I want to save newly created file, I have to manually browse for folder where I want to save that file (using Save file dialog from the external application). However, if there was a function similar to MkDir that prompts for file name and creates an empty file with given name in current folder, then, if I want to edit that file, I'd simply use F4 to open my preferred editor.

This could be very useful, for example, for web developers who want to quickly create a new HTML or PHP file without having to go through browsing for the same folder that is already open in TC.

I'd like to hear what others think about this.
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Shift+F4?

I recommend to read Keyboard.txt file in TC folder, maybe you will know other useful shortcuts. :wink:
User avatar
DoctorDDL
Junior Member
Junior Member
Posts: 3
Joined: 2007-06-14, 09:56 UTC
Location: Belgrade, Serbia

Post by *DoctorDDL »

Ok. This was a bit dumb from me, because after so many years of using TC I completely forgot about checking some basic things. Thanks for pointing it out.
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

You're welcome. :)

BTW Shift+F4 shortcut (like many others) came from DOS file managers.
User avatar
Hacker
Moderator
Moderator
Posts: 13144
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

[mod]Moved to the English forum.

Hacker (Moderator)[/mod]
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
Sudip
Junior Member
Junior Member
Posts: 14
Joined: 2012-02-17, 08:54 UTC
Location: India

Post by *Sudip »

MVV wrote:Shift+F4?

I recommend to read Keyboard.txt file in TC folder, maybe you will know other useful shortcuts. :wink:
MVV you are no more than best. Just "Shift+F4?" speaks everything. No junk each letter worth millions, for us novices, to understand it all !
sorcar
Member
Member
Posts: 100
Joined: 2005-04-12, 17:45 UTC
Location: U.S.

Post by *sorcar »

Shift+F4 is much better than what I do: "copy nul filename" at the command line. But it also opens a text editor, for which I have no need. I wonder if there is an alternative.
Last edited by sorcar on 2012-02-22, 20:37 UTC, edited 1 time in total.
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

You may create a user-command (with shortcut) or a buttonbar button that will ask for a filename and open it in your favorite editor (if it can create files; notepad.exe is used just for example) using my AskParam:

Code: Select all

Command: AskParam.exe
Parameters: /c"Edit new file" /t"Untitled.txt" /p"Enter filename:" "notepad.exe" "%P\%%1"
umbra
Power Member
Power Member
Posts: 876
Joined: 2012-01-14, 20:41 UTC

Post by *umbra »

2MVV
I think he was asking, whether there was a method to create a new file WITHOUT opening editor. At least that's what I would like to know.
Windows 10 Pro x64, Windows 11 Pro x64
damjang
Senior Member
Senior Member
Posts: 215
Joined: 2003-10-09, 15:58 UTC
Contact:

Post by *damjang »

I use this
sorcar
Member
Member
Posts: 100
Joined: 2005-04-12, 17:45 UTC
Location: U.S.

Post by *sorcar »

2umbra
You are right. I was looking for an easier way to create 0-length files. I now do Shift+F4, after MVV's brief and beautiful suggestion, or call a batch file from a button which creates through "copy nul filename".
2damjang
Thanks for the link, icfu explains there the need for such files. But I am not sure I found a strightforward way yet.
User avatar
G-nom
Junior Member
Junior Member
Posts: 6
Joined: 2012-02-24, 00:48 UTC
Location: Russia

Post by *G-nom »

You can create user command like

Code: Select all

Command: cmd /c copy nul
Parameters:?
Whenever you call it, TC will show empty parameter prompt window where you can type filename to create. Just don't forget about quotes around filenames with spaces.
umbra
Power Member
Power Member
Posts: 876
Joined: 2012-01-14, 20:41 UTC

Post by *umbra »

2G-nom
Thanks, exactly what I was looking for.
Windows 10 Pro x64, Windows 11 Pro x64
krypton
Junior Member
Junior Member
Posts: 13
Joined: 2013-01-24, 18:04 UTC
Location: Italy

Post by *krypton »

G-nom wrote:You can create user command like

Code: Select all

Command: cmd /c copy nul
Parameters:?
Whenever you call it, TC will show empty parameter prompt window where you can type filename to create. Just don't forget about quotes around filenames with spaces.
Great and simply idea!

For those who are lazy like me and haven't intention to type the double quotes  around filenames with spaces:
1- Create an empty bat file with this string inside: copy nul "%*"
Example: C:\totalcmd\NewFile.bat
2- Copy the path of the bat file that you have created before
3- Then go in Total Commander configuration and click on Misc.
4- Choose an Hotkey, for example F11 that isn't used, then click on magnifier
5- In Category menu choose usercmd.ini section, press on "New..." and type the command name.
Example: em_NewFile
6- In the field "Command" paste the path of the bat file
In the field "Parameters" write a question mark (?)
In the field "Icon file" choose an icon that you want, for example the
standard Windows icons that are situated in: C:\Windows\System32\shell32.dll
7- Finally confirm the new hotkey
You can now create a new empty file by pressing F11 key in the current directory.
Image: http://oi46.tinypic.com/e88j6w.jpg
Suggestion: You can also create a button in the button bar for the NewFile command and launch it by a mouse clicking.
Last edited by krypton on 2013-02-17, 18:48 UTC, edited 1 time in total.
User avatar
HolgerK
Power Member
Power Member
Posts: 5412
Joined: 2006-01-26, 22:15 UTC
Location: Europe, Aachen

Post by *HolgerK »

krypton wrote:1- Create an empty bat file with this string inside: copy nul "%1"
You should use "%*" to make it work.

Regards
Holger
Post Reply