From: Daniel Baird Date: 2006-04-30T20:01:52+09:00 Subject: Re: can a ruby script perform a chdir on win xp? ------=_Part_21716_6484201.1146394907344 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 4/30/06, Bill Guindon wrote: > > On 4/29/06, Lloyd Zusman wrote: > > "Bill Guindon" writes: > > > > > On 4/29/06, Lloyd Zusman wrote: > > >> "Bill Guindon" writes: > > >> > > >> > > > >> > I like the look of it, but it's not working here: > > >> > > > >> > c:\work\active\apps>cdir.bat > > >> > (`cdir.rb`) was unexpected at this time. > > >> > > >> Hmm ... I wonder if this needs to run in a .cmd file instead of a > .bat > > >> file. Under winxp, it works for me in a .cmd file exactly as > written. > > >> Maybe if you rename your file to be cdir.cmd ... ??? > > >> > > > > > > Same results. Deleted the .bat file, and called it explicitly > > > (cdir.cmd) to make sure. > > > > Actually, I had to do this: > > > > `\path\to\ruby.exe cdir.rb` instead of just `cdir.rb` > > > > I accidentaly copied and pasted the command line that I posted here fro= m > > an earlier version that didn't work. I'm sorry for the confusion. > > > Nope, that didn't help (yet). Not sure that 'unfortunately' applies here > btw ;) > > > But I'm sure that this is do-able in windows, one way or the other. > > I'm inclined to agree, and thanks much for trying. If nothing else, > you gave me food for thought, and a couple of search terms. a slightly less trickey way to do it (and apologies if this was already proposed, I've been kinda skimming this thread up til now) would be to call your ruby program from a cmd file, and call another cmd file right after. then your ruby program could re-write the second cmd file. like this: doit.cmd contents: ruby myprog.rb followup.cmd followup.cmd contents (written by myprog.rb): cd c:\whatever\ ..pretty sure this would work, if you can't get the originally proposed command line magic to work. It'd work as .bat files too, so you could use it in Win98 or DOS or whatever. Cheers ;Daniel -- Daniel Baird http://danielbaird.com (TiddlyW;nks! :: Whiteboard Koala :: Blog :: Things That Suck) ------=_Part_21716_6484201.1146394907344--