How to query current Directory name into a variable for batch filesHow to set a folder name into a variable...

What are the rules for concealing thieves' tools (or items in general)?

Do I need an EFI partition for each 18.04 ubuntu I have on my HD?

Knife as defense against stray dogs

Why I don't get the wanted width of tcbox?

What will the Frenchman say?

CLI: Get information Ubuntu releases

Does the Shadow Magic sorcerer's Eyes of the Dark feature work on all Darkness spells or just his/her own?

Air travel with refrigerated insulin

Pre-Employment Background Check With Consent For Future Checks

Print last inputted byte

How can a new country break out from a developed country without war?

What is the difference between something being completely legal and being completely decriminalized?

Why do I have a large white artefact on the rendered image?

How can an organ that provides biological immortality be unable to regenerate?

Why didn’t Eve recognize the little cockroach as a living organism?

label a part of commutative diagram

How do you justify more code being written by following clean code practices?

Asserting that Atheism and Theism are both faith based positions

is this saw blade faulty?

What are the consequences of changing the number of hours in a day?

Does fire aspect on a sword, destroy mob drops?

Turning a hard to access nut?

pipe commands inside find -exec?

Why is indicated airspeed rather than ground speed used during the takeoff roll?



How to query current Directory name into a variable for batch files


How to set a folder name into a variable to use it in the same Batch file?Batch: Set Top-Level Folder Name as VariableHow can I launch batch files from another batch file while piping their output and retaining the current working directory?Creating a txt file for certain type of files using batchHow to write into a Log file from the batch file?The Directory name is too long in batchsend output of batch file to current directoryBatch File:List all files of a type, rename files, flatten the directoryHow to set a folder name into a variable to use it in the same Batch file?Batch to move files from root folder into sub-foldershow to create empty text files who's name matches those in an existing folder using a batch fileBatch: Set Top-Level Folder Name as Variable













0















I have been researching and trying without success to get the current directory name into a variable such as %CurrDirNam% for creating a text file with the same folder name something like this: copy %CurrDirNam% > nul 1.txt.
The only similar questions I can locate require that the folder name be supplied rather than fetching it from the OS for use as a variable.
Reference1 How to set a folder name into a variable to use it in the same Batch file? Reference2 Batch: Set Top-Level Folder Name as Variable









share







New contributor




Joanne is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

























    0















    I have been researching and trying without success to get the current directory name into a variable such as %CurrDirNam% for creating a text file with the same folder name something like this: copy %CurrDirNam% > nul 1.txt.
    The only similar questions I can locate require that the folder name be supplied rather than fetching it from the OS for use as a variable.
    Reference1 How to set a folder name into a variable to use it in the same Batch file? Reference2 Batch: Set Top-Level Folder Name as Variable









    share







    New contributor




    Joanne is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.























      0












      0








      0








      I have been researching and trying without success to get the current directory name into a variable such as %CurrDirNam% for creating a text file with the same folder name something like this: copy %CurrDirNam% > nul 1.txt.
      The only similar questions I can locate require that the folder name be supplied rather than fetching it from the OS for use as a variable.
      Reference1 How to set a folder name into a variable to use it in the same Batch file? Reference2 Batch: Set Top-Level Folder Name as Variable









      share







      New contributor




      Joanne is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.












      I have been researching and trying without success to get the current directory name into a variable such as %CurrDirNam% for creating a text file with the same folder name something like this: copy %CurrDirNam% > nul 1.txt.
      The only similar questions I can locate require that the folder name be supplied rather than fetching it from the OS for use as a variable.
      Reference1 How to set a folder name into a variable to use it in the same Batch file? Reference2 Batch: Set Top-Level Folder Name as Variable







      windows batch-file





      share







      New contributor




      Joanne is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.










      share







      New contributor




      Joanne is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.








      share



      share






      New contributor




      Joanne is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 2 mins ago









      JoanneJoanne

      1




      1




      New contributor




      Joanne is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      Joanne is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      Joanne is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          0






          active

          oldest

          votes











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "3"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });






          Joanne is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1415205%2fhow-to-query-current-directory-name-into-a-variable-for-batch-files%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          Joanne is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          Joanne is a new contributor. Be nice, and check out our Code of Conduct.













          Joanne is a new contributor. Be nice, and check out our Code of Conduct.












          Joanne is a new contributor. Be nice, and check out our Code of Conduct.
















          Thanks for contributing an answer to Super User!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1415205%2fhow-to-query-current-directory-name-into-a-variable-for-batch-files%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          VNC viewer RFB protocol error: bad desktop size 0x0I Cannot Type the Key 'd' (lowercase) in VNC Viewer...

          Couldn't open a raw socket. Error: Permission denied (13) (nmap)Is it possible to run networking commands...

          Why not use the yoke to control yaw, as well as pitch and roll? Announcing the arrival of...