-1

I have a batch file named CreateFolders.bat

The code is:

@echo off
md db in links output

Must I copy the batch file to the specific folder before I can run it? Is there anyway possible to have the options to run that specific batch file by a shotcut key or a menu option when you click the right mouse key?

I am dreaming or is it possible?

DavidPostill
  • 162,382
Heresh
  • 103

1 Answers1

0

Have a look to autohotkey it's very flexible. You got to use a bit of scripting but it is not that hard.

edit: To further add more detail to the answer:

First thing, you need to receive the path using arguments in your bat

@echo off
md %1/mydir

I altered this code I found here Autohotkey Filepath so you can execute a .bat in the exact path you want. The following code use the clipboard to copy the path you are currently in.

F1::
MsgBox, % gst()  ; Path
F8::
Run C:\MyBat.bat % gst() ; Execute your bat receiving the path
return
F7::
Run C:\MyBat.bat,,Hide ; Execute your bat without seeing the black window
return

; GetSelectedText or FilePath in Windows Explorer  by Learning one 
gst()
{   
        IsClipEmpty := (Clipboard = "") ? 1 : 0
        if !IsClipEmpty 
        {
                ClipboardBackup := ClipboardAll
                While !(Clipboard = "") 
                {
                      Clipboard = 
                      Sleep, 10
                }
        }
        Send, ^c
        ClipWait, 0.1
        ToReturn := Clipboard, Clipboard := ClipboardBackup
        if !IsClipEmpty
        ClipWait, 0.5, 1
        Return ToReturn
}

where F1, F7, F8 are the keys you need to press to be able to run your program

Joe
  • 711