I wants to do the following:
Open CMD then CD to current file’s directory then php current_file.
cd $file_path & php $file_name
How do I do it ST3? I do have Terminal package installed.
I wants to do the following:
Open CMD then CD to current file’s directory then php current_file.
cd $file_path & php $file_name
How do I do it ST3? I do have Terminal package installed.
actually i did this… after a lot of trail and error.
import os, sublime_plugin, subprocess
class CmdCommand(sublime_plugin.TextCommand):
def run(self, edit):
path, _ = os.path.split(self.view.file_name())
os.chdir(path)
filename = os.path.split(self.view.file_name())[1]
subprocess.Popen("C:\\Windows\\System32\\cmd.exe /K php %s" % filename)
Probably you want https://packagecontrol.io/packages/Console%20Exec .
With it, just add "target": "console_exec" in your .sublime-build. The build will be in a new external terminal (cmd under Windows by default).