Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: How can i copy a file name?  (Read 9019 times)

0 Members and 1 Guest are viewing this topic.

Mental

    Topic Starter


    Rookie

    How can i copy a file name?
    « on: February 23, 2008, 08:04:02 PM »
    hi
    i want copy a file name then with md command create a folder in same directory and rename the folder to name of file that copied ...
    eg:
    1 i have sample.txt
    2 i want copye this file name
    3 create sample folder in same directory

    i want type these in batch file ...

    GuruGary



      Adviser
      Re: How can i copy a file name?
      « Reply #1 on: February 23, 2008, 11:36:42 PM »
      What do you have so far, or where are you getting stuck?

      Mental

        Topic Starter


        Rookie

        Re: How can i copy a file name?
        « Reply #2 on: February 24, 2008, 04:05:26 AM »
        i want these for my program ...
        plz just tell me that how can i copy a file name?


        Dias de verano

        • Guest
        Re: How can i copy a file name?
        « Reply #3 on: February 24, 2008, 04:55:51 AM »
        What do you mean by "copy a file name"?

        Mental

          Topic Starter


          Rookie

          Re: How can i copy a file name?
          « Reply #4 on: February 24, 2008, 05:29:03 AM »
          i cant speak english very well
          copy file name in windows :



          i copied name of text file ( connection copied )
          now how can i do it in cmd ?

          Dias de verano

          • Guest
          Re: How can i copy a file name?
          « Reply #5 on: February 24, 2008, 05:31:21 AM »
          Why don't you do it in Windows? Cmd prompt does not have a clipboard.

          Is this right?

          In a folder you have 1 file only. if it is called sample.txt you want to create a folder there called sample?





          Mental

            Topic Starter


            Rookie

            Re: How can i copy a file name?
            « Reply #6 on: February 24, 2008, 05:48:44 AM »
            Quote
            In a folder you have 1 file only. if it is called sample.txt you want to create a folder there called sample
            yeah
            if i do it my problem 50% solved

            Dias de verano

            • Guest
            Re: How can i copy a file name?
            « Reply #7 on: February 24, 2008, 06:07:22 AM »
            what is the other 50%?

            Mental

              Topic Starter


              Rookie

              Re: How can i copy a file name?
              « Reply #8 on: February 24, 2008, 06:45:04 AM »
              dear friend
              if we cant solved this 50% , so we will cant  solve other 50% because related its ...

              Dias de verano

              • Guest
              Re: How can i copy a file name?
              « Reply #9 on: February 24, 2008, 06:48:05 AM »
              yes that is why I asked. They are related. So I need to know the whole problem. When asking for help in forums, it is a bad idea to be mysterious.

              WillyW



                Specialist
              • Thanked: 29
              • Experience: Experienced
              • OS: Windows XP
              Re: How can i copy a file name?
              « Reply #10 on: February 24, 2008, 12:17:27 PM »
              Quote
              In a folder you have 1 file only. if it is called sample.txt you want to create a folder there called sample
              yeah
              if i do it my problem 50% solved

              One way -    Use a free command line utility program.

              See:
              http://home.mnet-online.de/horst.muc/main.htm
              particularly:
              http://home.mnet-online.de/horst.muc/div.htm
              Check out    VARSET .

              It says it works under WinNt and Win2000.    I bet it works under XP too.
              You'd have to try it to be sure.

              It is simple to use.   Read the docs with it.

              With it, you can set an environment variable that is equal to a filename.
              Next, you could then use the   MD command along with that environment variable to create your new directory.
              I tried it under Win98SE.    Works fine.

              I hope this helps.

              .



              WillyW



                Specialist
              • Thanked: 29
              • Experience: Experienced
              • OS: Windows XP
              Re: How can i copy a file name?
              « Reply #11 on: February 24, 2008, 12:21:33 PM »
              Why don't you do it in Windows? Cmd prompt does not have a clipboard.

              Is this right?


              Side note:

              If ever you want to copy to/from the clipboard from the command line -  there is a free utility that will do it.

              See:
              http://home.mnet-online.de/horst.muc/div.htm#wclip
              and/or
              http://home.mnet-online.de/horst.muc/wbat32.htm

              I've tried Cliptext under '98 only.
              .



              Mental

                Topic Starter


                Rookie

                Re: How can i copy a file name?
                « Reply #12 on: February 24, 2008, 06:19:49 PM »
                Thx WillyW  :)
                i downloaded its , but im new dos user !!
                can you post that i how do with it ?? (For my problem ? )
                In a folder you have 1 file only. if it is called sample.txt you want to create a folder there called sample

                Dias de verano

                • Guest
                Re: How can i copy a file name?
                « Reply #13 on: February 25, 2008, 01:05:38 AM »
                I think what Mental wants is to get a batch file to load a filename into a variable, strip off the extension, and use what is left as the name of a folder which is to be created. This is easily done using batch commands.


                e.g.

                fmake "sample.txt"

                fmake.bat

                Quote
                set name=%~dpn1
                mkdir "%name%"

                makes dir called "sample"


                Mental

                  Topic Starter


                  Rookie

                  Re: How can i copy a file name?
                  « Reply #14 on: February 25, 2008, 03:34:19 AM »
                  thx mate
                  but i put this batch file with a txt file in same directory and i run the batch ...
                  but not any happend  :(