Windows Command Prompt Capturing the current directory from a batch file RRS feed

  • Question

  • Hello all,

    I need write a script in windows Prompt that I need to  Capture the current directory from a batch file.

    (for example I have a file call test. txt in G:\\ load\text\test.txt,G:\\ load\text\test2.txt,...........). I have like 1000's of files and if I want to move these files to different server and If we don't have G:\\ drive it will be a prob. so windows has to capture the path untill the text files. So could any one help me writing a script. here is my sample script.

    set _=%CD%\curfile.txt cd ... some other directory ... somecommand args %_% args

    I tried this but It's not working as I need to change the directory every time. Please do ask me for any questions.



    • Edited by siddu_123 Tuesday, September 1, 2015 9:29 PM
    Tuesday, September 1, 2015 9:23 PM