Amit , Pathak (IE10) [mailto:amit.pathak / honeywell.com] inquired: > Sent: Wednesday, April 30, 2003 6:06 PM > To: ruby-talk / ruby-lang.org; vmreyes / us.ibm.com > Cc: 'ruby-talk / ruby-lang.org' > Subject: pwd equivalent in DOS > > > Hi, > I need to retain the present working directory(pwd) > information( in DOS) into a variable to be used later in a > batch file. say something like > set d = pwd > then, cd %d% > can you tell me how to achieve it in DOS. > your command below d= Dir.pwd does not work for me on > win2k/dos. Thanks, Amit > I use Dir.chdir and Dir.getwd. like eg... C:\family\ruby>type a1.rb dir2 = "c:\\family" #ready dir2, we'll transfer here; note the \\ #get wd and remember in dir1 dir1 = Dir.getwd puts "#{dir1}" system("dir /D") #disp wd contents #transfer to dir2 Dir.chdir(dir2) puts "#{Dir.getwd}" system("dir /D") #display contents #transfer back to dir1 Dir.chdir(dir1) puts "#{Dir.getwd}" #note we're back #eof a1.rb hth. kind regards -botp