Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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

share|improve this question
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 '11 at 11:08
I found the fix. See my answer. – firefusion Mar 16 '11 at 11:25

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

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

share|improve this answer

use this :

Windows Registry Editor Version 5.00


@="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

share|improve this answer
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 '11 at 21:33
up vote 0 down vote accepted

Ok by following this...

I got as far as this... [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.

share|improve this answer
Ok, I fixed it and the above file works now! – firefusion Mar 16 '11 at 11:23

You must log in to answer this question.

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