What is the windows version of PWD? need it for a batch proggi.....man I feel uber having forgoten DOS and become full BASH...lol
- Noia
Printable View
What is the windows version of PWD? need it for a batch proggi.....man I feel uber having forgoten DOS and become full BASH...lol
- Noia
just typing cd without any arguments will tell u the path of current working dir.
Ha, 30 seconds after I hit submit, I rememberd......net faild on me tho :( but thanks none the less :) another problem, kinda related.
I'm trying to store the current working directory, because it changes from time to time, and then be able to navigate back there, thus I tried
which works, but to be able to navigate to it (and it's a root directory, but can be D:, E: or F: or more :s) I would have to use aCode:CD >> text.txt
but how do I get the data in text.txt into the variable path ?Code:cd\
%path%
i think a C program help more than a DOS .bat file ...after all u dont have the luxary of sed,awk and grep in DOS. Hope i wont be tuff to code such a program.
i am giving some site to help u with
http://garbo.uwasa.fi/pc/batchutil.html --- MS-DOS batch programming and usage related scripts and other material
http://dmoz.org/Computers/Software/O...Batch/faq.html ---- Batch Programming FAQ
http://www.saliu.com/menu.html --- DOS Based Menu Driven system
http://drscriptt.riverviewtech.net/docs/dbatchapl.html --- DOS A programming Language
http://www.simtel.iif.hu/pub/msdos/batchutl/ -- DOS Batch Programming Utilities
http://gearbox.maem.umr.edu/~batch/batchtoc.htm -- A Nice Batch Tute
http://www.nc5.infi.net/~wtnewton/batch/index.html -- More Batch Programming Utilities
http://student.vub.ac.be/~dvandeun/batcoll.all -- A Good Tute
http://www.pressroom.com/~tglbatch/ -- May Come Handy
http://web2.iadfw.net/oscar10/c/link...batch%20files/ -- Well Organised Links For BAT Programming.
the program is already inplace, only have one issue and I can't seem to resolve it.
I have a Batch that first calls First.bat, when First.bat is finished, if sets the current directory to a virtual drive and gives the power back to the Master batch. Since the program(s) will be on all kinds of drive letters, they need to be able to navigate back to their source.
To do this I need to capture the current directory at the start of the master batch, and store it as a variable, once that is done, the rest is a walk in the park.
I'v tried loading CD to a file and then back into a variable, didn't have much luck
also tried using %1 etc, but it only spat out where the batch interpreters where for some reason.
I don't know if any one can help me with this issue, it's a really tiny pice of code, and all that I need to compleete this damn boot disk. Thanks.
- Noia
Ever tried to get the Date into a variable?
Looking at this piece of old code I had lying around you may have luck with the following:Code:FOR /F "delims==" %%i IN ('DATE /T') DO @SET datum=%%i
After this %oldcwd% will have your old working directory. %olddrive% will hold the old drive letter. So to change back to where you came from you can do this:Code:FOR /F "delims==" %%i IN ('CD') DO @SET oldcwd=%%i
SET olddrive=%oldcwd:~0,2%
Code:%olddrive%
cd %oldcwd%
It's a dirty hack but...it'll probably get the job done :D
Edit: Just tested it. It works. Be carefull when changing drives! You cannot cd to say d:\test1 if you're currently working on c:
Edit2: I keep editting it :rolleyes: it now also changes between drives.