Help on PWD
Results 1 to 6 of 6

Thread: Help on PWD

  1. #1
    Now, RFC Compliant! Noia's Avatar
    Join Date
    Jan 2002
    Posts
    1,210

    Help on PWD

    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
    With all the subtlety of an artillery barrage / Follow blindly, for the true path is sketchy at best. .:Bring OS X to x86!:.
    Og ingen kan minnast dei linne drag i dronningas andlet den fagre dag Då landet her kvilte i heilag fred og alle hadde kjærleik å elske med.

  2. #2
    Senior Member
    Join Date
    May 2003
    Posts
    472
    just typing cd without any arguments will tell u the path of current working dir.
    guru@linux:~> who I grep -i blonde I talk; cd ~; wine; talk; touch; unzip; touch; strip; gasp; finger; mount; fsck; more; yes; gasp; umount; make clean; sleep;

  3. #3
    Now, RFC Compliant! Noia's Avatar
    Join Date
    Jan 2002
    Posts
    1,210
    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
    Code:
    CD >> text.txt
    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 a
    Code:
    cd\
    %path%
    but how do I get the data in text.txt into the variable path ?
    With all the subtlety of an artillery barrage / Follow blindly, for the true path is sketchy at best. .:Bring OS X to x86!:.
    Og ingen kan minnast dei linne drag i dronningas andlet den fagre dag Då landet her kvilte i heilag fred og alle hadde kjærleik å elske med.

  4. #4
    Senior Member
    Join Date
    May 2003
    Posts
    472
    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.
    guru@linux:~> who I grep -i blonde I talk; cd ~; wine; talk; touch; unzip; touch; strip; gasp; finger; mount; fsck; more; yes; gasp; umount; make clean; sleep;

  5. #5
    Now, RFC Compliant! Noia's Avatar
    Join Date
    Jan 2002
    Posts
    1,210
    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
    With all the subtlety of an artillery barrage / Follow blindly, for the true path is sketchy at best. .:Bring OS X to x86!:.
    Og ingen kan minnast dei linne drag i dronningas andlet den fagre dag Då landet her kvilte i heilag fred og alle hadde kjærleik å elske med.

  6. #6
    Just Another Geek
    Join Date
    Jul 2002
    Location
    Rotterdam, Netherlands
    Posts
    3,401
    Ever tried to get the Date into a variable?

    Code:
    FOR /F "delims==" %%i IN ('DATE /T') DO @SET datum=%%i
    Looking at this piece of old code I had lying around you may have luck with the following:

    Code:
    FOR /F "delims==" %%i IN ('CD') DO @SET oldcwd=%%i
    SET olddrive=%oldcwd:~0,2%
    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:
    %olddrive%
    cd %oldcwd%

    It's a dirty hack but...it'll probably get the job done

    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 it now also changes between drives.

    Oliver's Law:
    Experience is something you don't get until just after you need it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •