Can I run a batch file (.bat) from within the IDE?
Hello,
I have a batch (.bat) file (with only one line of code in it) that recompiles sass files. This bat file is inside my project files of course. So far I always just navigated to its location using windows explorer and ran it. But I was wondering if it's possible to run this bat file from withing the IDE as opposed to going to explorer all the time?
Eg, could I just select the bat file in the project file list and ran it somehow?
Thanks!
请先登录再写评论。
Hi there,
Multiple ways:
P.S.
v6 can now autocompile SASS (any any other) files on Save via File Watchers plugin
Thanks, sound great!
However, I need some help. It seems like I'm not able to accomplish running the cmd. I tried option #2, to create an external tool.
I have a batch file called "compass-compile.bat". Inside this batch file a single command "compass compile". Normally I just couble click this batch file in Windows Explorer and it will just compile my sass file. So this is what I tried:
1. I invoked Settings > External Tools and Add a new tool.
2. Under Tool Settings I have:
3. This just opens the console window and doesn't do anything. So I tried chaning the Tool settings to
4. Same result. Nothing. So then
5. Nothing. Next:
6. Nothing. Next:
7. Error, because working directory is not a working directory (obviously, but just tried)
I'm out of ideas. I think I've tried all possible combinations. I have no idea why I'm not able to automatically run this this batch file. I did read the help file, but didn't help me figure out what am I doing wrong. Any ideas?
Thanks.
Well .. if you have .bat file, then you may use it directly in "Program" field -- it depends what that bat file does (what other programs/batch files it calls) and what output you expect to see. For me, not all bat files were working fine (the final result/output, not just execution) if invoked directly, that's why I prefer going via cmd.exe route (possibly it is just my specific environment, don't know for sure).
When going via cmd.exe, you just need to check how it works (cmd.exe /?). They key here -- you need to use /C (or /K if so required) parameter to execute another command. This is what I do when executing phpunit outside IDE (executing specific test file):
Program: cmd.exe
Parameters: /C "phpunit $FilePath$"
Working directory: $ProjectFileDir$\tests\
In your case it MAY look like this (I'm assuming that compass-compile.bat is located in D:\wamp\www\sencha\CU-iPad\resources\scss\):
Program: cmd.exe
Parameters: /C "compass-compile.bat"
Working directory: $ProjectFileDir$\resources\scss\
That's what it was! It's working! Thank you!