4

I'd like to create a shortcut to run cmd at a particular location with a few commands.

I'm hoping from there I can work out how to make it a right click option to "Run my cmd commands here..."

I've found the shortcuts to run CMD with ruby. Which is part of what I want. C:\Windows\System32\cmd.exe /E:ON /K C:\Ruby191\bin\setrbvars.bat

Then in the target field I set me location. Now I just need to know how to pass it some startup arguments.

It is basically to help me run livereload easily on folders. LiveReload is a mini webserver/ruby gem that will auto refresh the browser when you save changes to files contained within the folder you're running it in https://github.com/mockko/livereload

So basically it is running cmd, launching ruby, passing in the directory and activating livereload.

2
  • I'm one of the developers of LiveReload. I'd like that to. You would also need to somehow show all enabled directories. And an option to stop it.
    – NVI
    Mar 14, 2011 at 11:08
  • I found the fix. See my answer.
    – firefusion
    Mar 16, 2011 at 11:25

3 Answers 3

1

When you create a batch file (.bat). Any thing that is dragged and dropped will infact turn into a command line parameter.

You can access these parameters with a %1, %2, %3... etc

So in you case ...So basically it is running cmd, launching ruby, passing in the directory and activating livereload...

in your bat file (assuming your ruby stuff is properly in your path)

@echo off
echo %1
ruby myScript.rb %1
EXIT

then all you would need to do is drag and drop that directory onto the script and all will run properly

1

use this :

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\shell\livereload] 
@="Livereload" 

[HKEY_CLASSES_ROOT\Directory\shell\livereload\Command] 
@="cmd.exe  /E:ON /K C:\\Ruby191\\bin\\setrbvars.bat  & pushd %L & @livereload"

works for me... you can edit @="Livereload" to change what it says in the context menu

1
  • Would you mind telling me where did you find the use of %L or explanation page ? i know %L give the whole path, is there another variable, if I just want the current directory name, without the whole path?
    – freshWoWer
    Nov 14, 2011 at 21:33
0

Ok by following this... http://www.windowsitpro.com/article/registry2/how-can-i-open-a-command-prompt-at-my-current-directory-in-explorer-.aspx?cpage=2

I got as far as this... http://dl.dropbox.com/u/497583/code/livereload.reg [EDIT] The above file works just fine now. I just need && to seperate commands.

But I need to know how to pass it further commands like "livereload". Also it opens on the folder you're currently in and not the folder you have right clicked.

1
  • Ok, I fixed it and the above file works now!
    – firefusion
    Mar 16, 2011 at 11:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .