Execute less compiler anywhere on the computer

Posted by Xenioz on Stack Overflow See other posts from Stack Overflow or by Xenioz
Published on 2012-09-26T21:36:04Z Indexed on 2012/09/26 21:37 UTC
Read the original article Hit count: 335

Filed under:
|
|
|

I'm having a little problem with executing *.cmd files so I can execute them anywhere on the computer with cmd. What I exactly want is to execute the less.cmd file, which support optional arguments and uses lessc.wsf (Less.js compiler for Windows Script Host) for converting less css to pure css.

The less.cmd contains:

::For convenience
@cscript //nologo "%~dp0lessc.wsf" %*

What I've done so far:

added absolute path to lessc.cmd to the PATH system variable and moved .cmd in the PATHTEXT system variable to the beginning.

Also did this:

From a command prompt; 
assoc .bat 
should return with 
..bat=batfile 
If not 
assoc .bat=batfile 
to restore the default file type association. 

ftype batfile 
should return with 
batfile="%1" %* 
If not 
ftype batfile="%1" %* 
to restore the default "Open" action for the file type. 

This still doesn't work unless I approach the cmd file with a absolute path in cmd, if I enter lessc anywhere else then I get

C:\Intel Intel is not recognized as an internal or external command, operable program or batch file.

, I've restarted my computer more than once to be sure changes will take effect.

I hope somebody has the answer.

© Stack Overflow or respective owner

Related posts about css

Related posts about batch-file