0

I've tried for a while now every way possibly known to me, and have yet to crack this thing, it's probably very trivial but couldn't find the answer.

I want to run several commands at once using php shell_exec, for example shell_exec("cd ..; dir") but I am unable to find how to execute a few commands, what is the seperator? is it ;, is it /n? nothing seems to work.

Please note I am running with windows.

2
  • On Unix, you can separate commands with ;; not sure about Windows. That said, what's wrong with doing multiple shell_exec() calls? Much easier to debug, too. Commented Feb 18, 2013 at 15:32
  • @Pekka , each shell exec launches a new instance of shell, so they're missing the context Commented Feb 18, 2013 at 15:35

1 Answer 1

2

https://superuser.com/a/62854

&& will execute command 2 when command 1 is complete providing it didn't fail, & will execute regardless.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.