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

Author Topic: white spaces in path while using start command  (Read 10280 times)

0 Members and 1 Guest are viewing this topic.

Grimbear13

    Topic Starter


    Rookie

    white spaces in path while using start command
    « on: December 07, 2009, 09:49:26 AM »
    I'm trying to make a startup process at work.  I need it to open several programs in a certain order.  The problem I keep running into is white spaces in the directories or the folders I need opened.

    start C:\folder1\folder2\Folder To Be Opened

    It will either tell me that Folder does not exist there or it will open another folder that is just that first word.  Since I am at work and these are used by other processes I cannot just rename them.  Also I found that I could not use "" like in many other languages and batch processes because the start command automatically uses the "" to assign window title. 

    I attempted to use the /d command but that didn't seem to work as well as assigning the path to a variable to be called.  However when using variables I couldn't get it to run the path and not whatever the varaiable name was.

    set TM="Ticket Folder"

    start C:\fold1\fold2\TM
    cannot find TM

    start C:\fold1\fold2\%TM
    cannot find TM

    start C:\fold1\fold2\%%TM
    cannot find %TM

    I had previously run into issues with variables in for loops and the double % was the fix so I attempted here as well.

    Thank you in Advance for reading/assistance.

    nothlit



      Intermediate

      Thanked: 2
      Re: white spaces in path while using start command
      « Reply #1 on: December 07, 2009, 10:00:08 AM »
      To expand a variable you need to do

      Code: [Select]
      %tm%

      Have you tried
      Code: [Select]
      Start explorer C:\folder1\folder2\folder

      billrich



        Rookie

        Thanked: 1
        Re: white spaces in path while using start command
        « Reply #2 on: December 07, 2009, 10:23:19 AM »

        C:\batch>type  grimbear.bat
        Code: [Select]
        @echo off
        REM  TM below is variable and runs in RAM
        REM  C:\fold1\fold2\TM.  TM is a file stored on the HDD.
        REM Fold1 and fold2 are directories located on the HDD.

        cd \


        set TM="Ticket Folder"

        echo TM = %TM%

        cd \
        cd batch
        md fold1
        cd fold1
        md fold2
        cd fold2

        echo this a file called TM  > TM.txt

        type TM.txt

        dir *.*

        Output:

        C:\batch>grimbear.bat
        TM = "Ticket Folder"
        This a file called TM
         Volume in drive C has no label.
         Volume Serial Number is F4A3-D6B3

         Directory of C:\batch\fold1\fold2

        12/07/2009  11:18 AM    <DIR>          .
        12/07/2009  11:18 AM    <DIR>          ..
        12/07/2009  11:20 AM                25 TM.txt
                       1 File(s)             25 bytes
                       2 Dir(s)  305,553,166,336 bytes free

        C:\batch\fold1\fold2>

        gpl



          Apprentice
        • Thanked: 27
          Re: white spaces in path while using start command
          « Reply #3 on: December 07, 2009, 11:58:46 AM »
          Try
          Code: [Select]
          start "C:\fold1\fold2\%TM%"

          billrich



            Rookie

            Thanked: 1
            Re: white spaces in path while using start command
            « Reply #4 on: December 07, 2009, 12:39:59 PM »
            Try
            Code: [Select]
            start "C:\fold1\fold2\%TM%"

            Is  %TM%  a file or a variable?

            If TM is a file is the extention .txt . . . TM.txt?

            BC_Programmer


              Mastermind
            • Typing is no substitute for thinking.
            • Thanked: 1140
              • Yes
              • Yes
              • BC-Programming.com
            • Certifications: List
            • Computer: Specs
            • Experience: Beginner
            • OS: Windows 11
            Re: white spaces in path while using start command
            « Reply #5 on: December 07, 2009, 12:45:33 PM »
            Is  %TM%  a file or a variable?

            If TM is a file is the extention .txt . . . TM.txt?

            it's a variable, according to the first post:

            Quote
            set TM="Ticket Folder"

            the OP has tried %TM and %%TM but missed the proper method of accessing environment variables, which was to delimit both ends with percent signs %TM%.
            I was trying to dereference Null Pointers before it was cool.

            billrich



              Rookie

              Thanked: 1
              Re: white spaces in path while using start command
              « Reply #6 on: December 07, 2009, 01:19:17 PM »
              it's a variable, according to the first post:

              the OP has tried %TM and %%TM but missed the proper method of accessing environment variables, which was to delimit both ends with percent signs %TM%.

              Grimbear (OP ) cannot find the variable  TM  Or %TM%  on the hard disk drive:

              start C:\fold1\fold2\TM

              "cannot find TM"  (System Error )

              "cannot find %TM%"  (System Error )

              Helpmeh



                Guru

              • Roar.
              • Thanked: 123
                • Yes
                • Yes
              • Computer: Specs
              • Experience: Familiar
              • OS: Windows 8
              Re: white spaces in path while using start command
              « Reply #7 on: December 07, 2009, 01:28:36 PM »
              Grimbear (OP ) cannot find the variable  TM  Or %TM%  on the hard disk drive:

              start C:\fold1\fold2\TM

              "cannot find TM"  (System Error )

              "cannot find %TM%"  (System Error )

              Because %TM% already has quotes in it maybe? And on a different note, what happened to your post count? If you don't feel comfortable talking about it in public, you can send me a pm.
              Where's MagicSpeed?
              Quote from: 'matt'
              He's playing a game called IRL. Great graphics, *censored* gameplay.

              Salmon Trout

              • Guest
              Re: white spaces in path while using start command
              « Reply #8 on: December 07, 2009, 01:30:47 PM »

              Salmon Trout

              • Guest
              Re: white spaces in path while using start command
              « Reply #9 on: December 07, 2009, 01:34:45 PM »
              Also I found that I could not use "" like in many other languages and batch processes because the start command automatically uses the "" to assign window title. 

              Yes, it does, but you can still use them later on e.g.

              Code: [Select]
              start "" "C:\Program Files\Ahead DVD Ripper\Ahead DVD Ripper.exe"

              BC_Programmer


                Mastermind
              • Typing is no substitute for thinking.
              • Thanked: 1140
                • Yes
                • Yes
                • BC-Programming.com
              • Certifications: List
              • Computer: Specs
              • Experience: Beginner
              • OS: Windows 11
              Re: white spaces in path while using start command
              « Reply #10 on: December 07, 2009, 01:51:45 PM »
              Grimbear (OP ) cannot find the variable  TM  Or %TM%  on the hard disk drive:

              "cannot find %TM%"  (System Error )

              he never tried %TM%.
              I was trying to dereference Null Pointers before it was cool.

              Salmon Trout

              • Guest
              Re: white spaces in path while using start command
              « Reply #11 on: December 07, 2009, 01:54:00 PM »
              Nothing changes, does it?  ::)

              Helpmeh



                Guru

              • Roar.
              • Thanked: 123
                • Yes
                • Yes
              • Computer: Specs
              • Experience: Familiar
              • OS: Windows 8
              Where's MagicSpeed?
              Quote from: 'matt'
              He's playing a game called IRL. Great graphics, *censored* gameplay.

              BC_Programmer


                Mastermind
              • Typing is no substitute for thinking.
              • Thanked: 1140
                • Yes
                • Yes
                • BC-Programming.com
              • Certifications: List
              • Computer: Specs
              • Experience: Beginner
              • OS: Windows 11
              Re: white spaces in path while using start command
              « Reply #13 on: December 07, 2009, 02:04:08 PM »
              >:(

               ???

              Billrich was banned. That is why.
              I was trying to dereference Null Pointers before it was cool.

              billrich



                Rookie

                Thanked: 1
                Re: white spaces in path while using start command
                « Reply #14 on: December 07, 2009, 02:20:23 PM »
                he never tried %TM%.

                Variables can be found in RAM.  Files can be found on the Hard Disk Drive.

                echo Variable TM = %TM%

                A file TM  on the Hard Disk Drive is  found:

                type C:\folder1\folder2\TM.txt

                BC_Programmer


                  Mastermind
                • Typing is no substitute for thinking.
                • Thanked: 1140
                  • Yes
                  • Yes
                  • BC-Programming.com
                • Certifications: List
                • Computer: Specs
                • Experience: Beginner
                • OS: Windows 11
                Re: white spaces in path while using start command
                « Reply #15 on: December 07, 2009, 02:23:06 PM »
                his %TM% variable was set to a folder name.
                therefore

                Code: [Select]
                start "" "C:\fold1\fold2\%TM%"

                is what he wants.
                I was trying to dereference Null Pointers before it was cool.

                Salmon Trout

                • Guest
                Re: white spaces in path while using start command
                « Reply #16 on: December 07, 2009, 02:36:20 PM »
                Here we go again...


                billrich



                  Rookie

                  Thanked: 1
                  Re: white spaces in path while using start command
                  « Reply #17 on: December 07, 2009, 05:12:50 PM »
                  Quote from: BC_Programmer link=topic=he never tried %TM%.
                  [/quote

                  start "" "C:\fold1\fold2\%TM%"


                  C:>start "" "C:batch\fold1\fold2\%TM%"
                  The system cannot find the file
                  C:\fold1\fold2\C:\batch\fold1\fold2\.




                  C:\batch>type gpl2.bat
                  Code: [Select]
                  @echo off

                  set TM="C:\fold1\fold2\"

                  echo TM=%TM%

                  start "" "%TM%"
                  pause

                  start "" "C:\fold1\fold2\%TM%"


                  pause

                  start "%TM%"

                  pause
                  C:\batch>

                  BC_Programmer


                    Mastermind
                  • Typing is no substitute for thinking.
                  • Thanked: 1140
                    • Yes
                    • Yes
                    • BC-Programming.com
                  • Certifications: List
                  • Computer: Specs
                  • Experience: Beginner
                  • OS: Windows 11
                  Re: white spaces in path while using start command
                  « Reply #18 on: December 07, 2009, 05:30:03 PM »
                  refer to the original post. The assumption being made is that, although the great Billrich doesn't have this particular folder on his drive, the OP, who defined the criteria upon which everybody (aside from the great Billrich, of course) is making suggestions. the fact that the OP says:

                  Quote
                  set TM="Ticket Folder"

                  start C:\fold1\fold2\TM
                  cannot find TM

                  start C:\fold1\fold2\%TM
                  cannot find TM

                  start C:\fold1\fold2\%%TM
                  cannot find %TM

                  basically means that these folders do not actually exist on their machine either, and rather they are providing this code as an example of what they need, which they expressed earlier.

                  There are in fact two issues the OP was having; one was the use of quotes around the folder name, which Salmon Trout explained requires a set of "" to define no title before the quotes around the actual folder name. The folder name itself, as presented by the OP above, is acquired by a path (not necessarily C:\fold1\fold2, but rather that is being used as an alias for the actual folder name and to indicate to those of us with cognitive capabilites that they intend to use this sort of command on folders in the heirarchy) which is built using the TM environment variable. the TM variable is, in his above example, being set to "Ticket Folder" this in and of itself presents another issue; the proper assignment should be, as Helpmeh, another PWWPA (Post Who Was Paying Attention) pointed out, without quotes. Instead, the final command should be
                  Code: [Select]
                  set TM=Ticket Folder
                  start "" "C:\fold1\fold2\%TM%"

                  Now, to clarify again; the folders will probably not exist on anybody elses machine, and in fact since they are simply abstractions of the actual problem and not true folder names on the OP's machine they probably don't exist there. This of course makes it difficult to locate such abstractions on ones PC, especially when you set the variable to the wrong value. But not to worry, the concept is simple to explain.

                  When the OP specified Fold1\fold2\ etc, they are not in fact, speaking of actual folders by this name, but rather they are explaining that they will work with multiple folder names- or more precisely, that the actual names of the folders aren't important. The important point is explained earlier in the post, which is that they are having issues with the start command and using quotes. The examples given also suggest that they have not yet had experience using Environment variables, which, unlike loop variables on the command line (one percent sign preceding) or loop variables in a batch file (two percent signs preceding) require a percent sign on either side of the variable name. Again, having the proper data in the variable is of the utmost importance, and setting it to some arbitrary value is hardly the best way to test the method, especially when the setting given my the OP clearly indicates it is used to specify a single folder name within a folder hierarchy.

                  Considering the length of this post, I can make the apt prediction that by ignoring much if it you'll be able to continue to post your illogic and additionally make comments about how unnecessary the girth of my post was. The fact is your understanding of the concepts involved is the issue, not the length of my post, and your complete avoidance of that issue is what prevents you from learning these new things as they are presented to you, a statement made on several occasions my multiple users.
                  I was trying to dereference Null Pointers before it was cool.

                  Salmon Trout

                  • Guest
                  Re: white spaces in path while using start command
                  « Reply #19 on: December 08, 2009, 12:21:44 AM »
                  Paraphrasing slightly for the new folks: billrich is a twice banned very stupid troll who keeps coming back to ruin threads with his trash.

                  Helpmeh



                    Guru

                  • Roar.
                  • Thanked: 123
                    • Yes
                    • Yes
                  • Computer: Specs
                  • Experience: Familiar
                  • OS: Windows 8
                  Re: white spaces in path while using start command
                  « Reply #20 on: December 08, 2009, 03:13:02 PM »
                  Paraphrasing slightly for the new folks: billrich is a twice banned very stupid troll who keeps coming back to ruin threads with his trash.

                  Twice?!
                  Where's MagicSpeed?
                  Quote from: 'matt'
                  He's playing a game called IRL. Great graphics, *censored* gameplay.

                  Salmon Trout

                  • Guest
                  Re: white spaces in path while using start command
                  « Reply #21 on: December 08, 2009, 03:16:54 PM »
                  Twice?!

                  I though he must have been banned as JaneDoe or whatever he was calling himself. [Opens new tab) Joanlong I mean.

                  billrich



                    Rookie

                    Thanked: 1
                    Re: white spaces in path while using start command
                    « Reply #22 on: December 08, 2009, 03:32:56 PM »
                    I'm trying to make a startup process at work.  I need it to open several programs in a certain order.  The problem I keep running into is white spaces in the directories or the folders I need opened.

                    start C:\folder1\folder2\Folder To Be Opened


                    Grimbear,

                    How did you solve the problem of not finding the TM variable and/or folder?

                    Salmon Trout

                    • Guest
                    Re: white spaces in path while using start command
                    « Reply #23 on: December 08, 2009, 03:34:43 PM »
                    trollboy still doesn't get it.

                    Salmon Trout

                    • Guest
                    Re: white spaces in path while using start command
                    « Reply #24 on: December 09, 2009, 05:26:51 AM »
                    I though he must have been banned as JaneDoe or whatever he was calling himself. [Opens new tab) Joanlong I mean.


                    he was also banned as Miketaylor after he sent me a sick (very sick) PM

                    billrich



                      Rookie

                      Thanked: 1
                      Re: white spaces in path while using start command
                      « Reply #25 on: December 09, 2009, 09:38:18 AM »

                      Where is Grimbear?



                      Grimbear,

                      How did you solve the problem of not finding the TM variable and/or folder?

                      Salmon Trout

                      • Guest
                      Re: white spaces in path while using start command
                      « Reply #26 on: December 09, 2009, 09:47:45 AM »
                      He's completely crazy.

                      billrich



                        Rookie

                        Thanked: 1
                        Re: white spaces in path while using start command
                        « Reply #27 on: December 09, 2009, 09:57:37 AM »
                        I need it to open several programs in a certain order.  The problem I keep running into is white spaces in the directories or the folders I need opened.

                        start C:\folder1\folder2\Folder To Be Opened


                        Grimbear,

                        I apologize that the thread was unable to remain on topic.

                        Good luck with your project

                        Salmon Trout

                        • Guest
                        Re: white spaces in path while using start command
                        « Reply #28 on: December 09, 2009, 11:49:01 AM »
                        I apologize that the thread was unable to remain on topic.

                        Well, it was you, the banned loony, who helped drive it off topic, with your ridiculous posts, so maybe you should just STFU?

                        Why are you still here, by the way?

                        Grimbear13

                          Topic Starter


                          Rookie

                          Re: white spaces in path while using start command
                          « Reply #29 on: December 17, 2009, 10:06:23 AM »
                          Sorry for not checking this one sooner.  This was something that wasn't critical for anything in particular so I actually forgot about it :o!  But now that I read it thank you so much for the support and I'm going to try some of the stuff that you all mentioned, namely the first set of quotes to declare title and then the full literal path.

                          The variable there was just an attempt to force the folder to open something with a white space because I was hoping that through a variable it would take the literal string.

                          Also i guess I should have mentioned what I was trying to do if I didn't this is a program to run at startup to open the 3 folders that I work out of at work, they need to be opened in sequence so I'm going to have to put a delay between each one because some open faster than others (they're on different drives).  It's a nominally simple task, but my unfamiliarity with batching complicates things  :(.  I'm hoping the start command is the proper command to have the folders opened.

                          Thanks again for all the replies