Windows command line current directory variable




















Connect and share knowledge within a single location that is structured and easy to search. How can I set a variable with the current location? I'm thinking about using a for to get inside a lot of folders and check if some file exists, if the correct file exist I want to set the current folder to a variable so I can copy the path and copy the folder.

I usually surround my batch files with something like:. Edit : It seems I didn't understand the OP. My example gets the location of the currently running script, not the "Current Directory". I think there is a little confussion here. However, by rereading your original question, I think that you need the LAST PART of the current directory, that is, the name of the current location excluding all previous locations.

If so, then you may use this:. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Connect and share knowledge within a single location that is structured and easy to search. I want to send a path as an argument to an executable. How do I do that? Sign up to join this community. The best answers are voted up and rise to the top. Stack Overflow for Teams — Collaborate and share knowledge with a private group.

Create a free Team What is Teams? Learn more. How to send the current working directory as an argument in windows? Ask Question. This thread is locked. You can follow the question or vote as helpful, but you cannot reply to this thread. I have the same question 7. Report abuse. Details required :. Cancel Submit. It outputs the drive and path of the batch file. Batch file : How to get current directory by Srini. Reply Link. Thanks, this post has been very useful to me.

Leave this field empty.



0コメント

  • 1000 / 1000