Search code examples
batch-filekdb+startupscript

Execute code inside batch opened terminal


I’m writing a startup script for a kdb process (but I don’t think the type of process matters, could just as easily be python). I want the script to run my q file, and then inside the terminal, execute a line (myfunc[], for example). Trying the -c batch command gives “The system cannot find the file specified”. Any advice? Thanks. Code I am currently trying:

 cmd /k “q myqfile.q” -c “myfunc[]”

Solution

  • cmd /k "copy myqfile.q myqfile_.q & echo myfunc[] >> myqfile_.q & q myqfile_.q & del myqfile_.q"
    

    I create a copy of myqfile.q, then append myfunc[] to the copy, then run the copy, and finally delete the copy.