Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

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
add comment

3 Answers 3

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

share|improve this answer
add comment

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

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
add comment
up vote 0 down vote accepted

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.

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.