Syntax error. Your " are not paired.
Yup. The one in the middle is the one I didn't want.
In Windows Vista, "cd / ; dir" won't work, but "cd / && dir"
prints the root directory.
Interesting.
I'd already encountered problems with system under Windows, due
to the fact that it didn't invoke a command interpreter, but I'd
forgotten about them. A quick check on my Windows machine
(which wasn't handy when I responded earlier), however, shows
the first printing the current directory. (That's Windows XP
Professional, with SP 3, and the VC++ from Visual Studio 8,
version 14.00.50727.762.) Without invoking a command
interpreter, I don't see how the dir command would ever be
executed. I'm also wondering: under Unix (and presumably under
Windows as well), cd is a built-in command of the command
interpreter, and not a separate program. What does system do
about this?
Note that as far as I know, Windows doesn't specify anything
here, so it's entirely up to the compiler. Posix requires the
string to be interpreted by a Posix compatible shell (but
Solaris doesn't seem to be Posix compliant here).
In the end, it's very difficult to use system in any portable
manner. (I gave up with it, and ended up writing my own spawn,
once for Windows and once for Unix, just so that I know what I'm
getting.)