0

So, I've made a little batch file that simply compiles all the code I need and moves it to their right places. I've seen some people using the compile function to launch something like the batch file I've made, but I can't seen to figure out how they do that. Also, I need the launch environment to be the same as the batch file is. This is the batch I have.

@echo off
mkdir ..\..\build
pushd ..\..\build
cl -Zi ..\alfa\code\win32_alfa.cpp user32.lib gdi32.lib
popd

There's also a second feature I would like to know if it's possible. Can I somewhat search the folders near where my code is and if it finds the build.bat, launch it?

0

Um, it's pretty simple, you use M-x compile, it prompts you for a command to use and you specify your script.

  • Oh, that really worked thanks. Btw, does the compile command launches from the file directory I'm editing? Can I just use some relative paths to launch that bat? I want to make my project as portable as possible, since sometimes I need to move a lot. Also, is it possible to make it search for the bat file, really don't know, maybe using lisp? I want to keep this pattern to all my project, so each project will have a build.bat to make things quicker. – GiovaniAbel Jul 2 '16 at 23:54
  • @GiovaniAbel: The default directory that the command is started with is the same as the file you were editing. You can certainly run the script from somewhere else, by giving a path to M-x compile. Making it automatically switch to another directory could be done two ways. Doing it in lisp before launching the script is certainly possible, but a better way is probably to make the script do that. You have nothing about what your system is, it seems to be some mix of UNIX and non-UNIX that I don't recognize. BTW, the convention is when an answer works, the questioner should click the check. – MAP Jul 3 '16 at 0:13
  • Sorry, that check was really difficult to see (had to check on Questions how to mark it as answered :P). I'm actually on Windows, what's the best way to actually achieve this "search and run" script I want? – GiovaniAbel Jul 3 '16 at 22:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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