Windows: Copy and Rename a file in a single step? Shortcut?

4

2

I am tired of these steps when copying and renaming a file (Windows Explorer):

  1. CTRL+C
  2. CTRL+V
  3. Navigation keys
  4. F2

screenclip showing the renaming

Is there no feature or shortcut in Windows 7 that a file gets copied and is in rename-mode immediately?

Maybe this is a sophisticated question, but doing this 50 times per day would save at least 50 * 2 keyboard strokes.

PS: I know you can do it using the CMD copy "file1.txt" "file2.txt", but I'd like to do it directly in Windows Explorer.

Kai Noack

Posted 2014-11-01T07:53:27.427

Reputation: 1 559

Answers

2

 ; Press F1 in Explorer to copy and manually rename the copy of the selected file
 ; - If the size of the selected is less 50 MB, directly in the explorer
 ; - otherwise using an input box (because the copying process takes more time) 

#If WinActive("ahk_class CabinetWClass")

    $F1::
    ClipSaved := ClipboardAll 
    clipboard := "" 
    Send, ^c 
    ClipWait, 2
    if (!ErrorLevel)
    {
        SplitPath, clipboard,, dir, ext, NameNoExt
        If (ext = "")
        {
            MsgBox, No file selected
            clipboard := ClipSaved
            return
        }
        FileGetSize, size, %clipboard%, M
        If (size < 50)
        {
            Sleep, 100
            Send, ^v
            Sleep, 500
            ; Send, {F2} ; or
            SendInput, {F2}%NameNoExt% ; if you want to remove " - Copy"
        }
        else
        {
           InputBox, UserInput, Filename, Enter a name for the file,, 350, 120,,,,, %NameNoExt%
            if (!ErrorLevel)    
                FileCopy, %clipboard%, %dir%\%UserInput%.%ext%, 1  
        }
    }
    else
        MsgBox, No file selected
    Sleep, 300
    clipboard := ClipSaved
    return

#If

user3419297

Posted 2014-11-01T07:53:27.427

Reputation: 2 055

Close to the finish line! Only thing left: After hitting F1, it has the copied file with - Copy in the end. test.txt becomes test - Copy.txt, but the copied file should have the same name: test.txt - Is that possible? – Kai Noack – 2018-07-25T11:32:24.460

Try the edited answer. – user3419297 – 2018-07-25T12:38:37.427

Perfect! That's the solution. – Kai Noack – 2018-07-25T13:47:15.833

This works perfectly on Windows 7. Thank you! – Hashim – 2019-07-13T17:29:11.527

1

I think your best path is writing some script that does what you want, then put it in the registry so that it appears when you right click -> open with on the file. The script would take your file as a parameter and then copy and rename as you wish (especially if you only want to rename as in the example, with number suffix).

And if you're looking for keyboard only, you can place a shortcut to your script on the desktop, and in the shortcut properties assign it a keyboard shortcut.

If you need to give a specific name to the file (i.e. not just an auto-suffix) you can always pop an input box of your own from the script - it's easy in most languages.

Bottom line, if you can code it, it can be done... If not, it could be a good context to take your first coding steps!

Yonatan

Posted 2014-11-01T07:53:27.427

Reputation: 123