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

Author Topic: batch file to run program in another partition  (Read 32730 times)

0 Members and 1 Guest are viewing this topic.

rogernh

    Topic Starter


    Rookie

    • Experience: Beginner
    • OS: Unknown
    batch file to run program in another partition
    « on: January 09, 2012, 07:55:37 PM »
    Hi;

    I'm running an old dos file manager called stereo shell on a P4 pc under XP SP3.

    This batch works;

    @echo off
    e:
    cd \TRUE\grid\2011
    D:\stereo\sts.exe
    C:

    but this file doesn't;

    @echo off
    c:
    cd \zzz\Precur~1
    D:\stereo\sts.exe
    C:

    Stereo shell comes up correctly but in black and white instead of color and it doesn't know where it's associated files are.

    Please help

    Roger

    Raven19528



      Hopeful
    • Thanked: 30
      • Computer: Specs
      • Experience: Experienced
      • OS: Windows 7
      Re: batch file to run program in another partition
      « Reply #1 on: January 10, 2012, 10:21:06 AM »
      First, and this is more of a personal preference than anything, why aren't you using cd /d to change the folder and drive on one line?

      cd /d e:\TRUE\grid\2011

      or

      cd /d c:\zzz\Precur~1

      The reason I believe your second line isn't working is because you are using 8-dot-3 filename structure when you don't have to, and if there is any other file under the zzz file that starts with similar letters, you are asking for trouble. Why not use:

      cd /d "c:\zzz\Precur..."

      Using the quotes, you won't have any trouble with spaces or the like. Because it is a shell, my though is that it will do the conversions to 8-dot-3 file structure when the shell is started, and having the file already in 8-dot-3 is screwing up it's functions somehow. Try it and see what you come up with. If you are still having issues, try posting the full file path of the "c:\zzz" target so we can try to provide better and more accurate help.
      "All things that are
      Are with more spirit chased than enjoy'd" -Shakespeare

      rogernh

        Topic Starter


        Rookie

        • Experience: Beginner
        • OS: Unknown
        Re: batch file to run program in another partition
        « Reply #2 on: January 10, 2012, 11:18:32 AM »
        I don't use the cd /d because a) I didn't know about it (I'm an OLD dos user) and b) it doesn't work

        If I put the /d in, it ignores that line entirely and executes the next line, invoking stereo shell in it's own location.

        Quoting the path makes no difference. The full path is C:\zzz\Precursors

        The idea behind this is to move to a target directory and invoke StS from there so I don't have to manually change to the place I need to be. It works (normally) but not in this case.

        Roger

        Raven19528



          Hopeful
        • Thanked: 30
          • Computer: Specs
          • Experience: Experienced
          • OS: Windows 7
          Re: batch file to run program in another partition
          « Reply #3 on: January 10, 2012, 11:45:18 AM »
          If I put the /d in, it ignores that line entirely and executes the next line, invoking stereo shell in it's own location.

          That's odd. Try opening your cmd prompt and typing in the command and see what happens. Post any errors here so we can see them.

          Since there are no spaces, you should be able to just type cd c:\zzz\Precursors and it should work. Try this in the cmd prompt and if you run into anything, post it here. In fact, the best way to troubleshoot a script if it isn't a particularly long one is to manually type each line into a cmd prompt. Don't type @echo off though. You want echo to stay on so you can see what is going on.

          Try your original method of changing the drive, but try one change with your original script. On your cd lines, you don't need to include the /d, but do include the drive letter. Otherwise, if you type c: and it defaults to c:\Documents and Settings\rogernh you won't be able to find the zzz\Precursors folder because it will be looking under your profile instead of on the c: drive.
          "All things that are
          Are with more spirit chased than enjoy'd" -Shakespeare

          rogernh

            Topic Starter


            Rookie

            • Experience: Beginner
            • OS: Unknown
            Re: batch file to run program in another partition
            « Reply #4 on: January 10, 2012, 01:12:20 PM »
            If I enter cd in the run command window it says it's an unknown command.

            No variation of the full pathname works, quoted or otherwise

            I agree, the c: jumps to the wrong location but How can I tell it the correct location?

            Roger

            rogernh

              Topic Starter


              Rookie

              • Experience: Beginner
              • OS: Unknown
              Re: batch file to run program in another partition
              « Reply #5 on: January 10, 2012, 01:21:57 PM »
              Correction; the full path works in the run window but not in the batch file.

              now I'm really confused.

              Roger

              Raven19528



                Hopeful
              • Thanked: 30
                • Computer: Specs
                • Experience: Experienced
                • OS: Windows 7
                Re: batch file to run program in another partition
                « Reply #6 on: January 10, 2012, 01:25:31 PM »
                If I enter cd in the run command window it says it's an unknown command.

                Are you typing "cmd" in the run window and then these commands from the cmd prompt that pulls up? Just checking, as the way you are describing it is a little vague.

                Have you tried using CHDIR instead? If it is still giving you problems, then there are some underlying issues that you will need to address before trying this batch file (sounds like there may be if CD is not a recognized command anyway.)

                Quote
                No variation of the full pathname works, quoted or otherwise

                With the CD command not working, this doesn't surprise me. When we get the command working, we can concentrate on getting the parameters correct as well.

                Quote
                I agree, the c: jumps to the wrong location but How can I tell it the correct location?

                That will be taken care of when we get the CHDIR command working correctly. All you need to do is CHDIR to the full filepath (including drive letter) and it should work.
                "All things that are
                Are with more spirit chased than enjoy'd" -Shakespeare

                rogernh

                  Topic Starter


                  Rookie

                  • Experience: Beginner
                  • OS: Unknown
                  Re: batch file to run program in another partition
                  « Reply #7 on: January 10, 2012, 02:49:21 PM »
                  Ok, I'm using the "Run" window under XP SP3

                  If I type c:\zzz\Precursors in the space provided the correct directory appears

                  If I type cmd c:\zzz\Precursors a black command line box pops up and typing c:\zzz\Precursors in there changes it to that directory as entering dir proves.

                  BUT it does not work in a batch file.


                  Raven19528



                    Hopeful
                  • Thanked: 30
                    • Computer: Specs
                    • Experience: Experienced
                    • OS: Windows 7
                    Re: batch file to run program in another partition
                    « Reply #8 on: January 10, 2012, 03:28:23 PM »
                    This seems just really strange.

                    Please copy and paste the code below into the batch file, then run it. Once all is done, copy and paste the contents of the log.txt file here so I can see what happens.

                    Code: [Select]
                    @echo on
                    c: >>log.txt
                    chdir c:\zzz\Precursors >> c:\log.txt
                    start d:\stereo\sts.exe >>c:\log.txt
                    cd d:\stereo >>c:\log.txt
                    exit
                    "All things that are
                    Are with more spirit chased than enjoy'd" -Shakespeare

                    rogernh

                      Topic Starter


                      Rookie

                      • Experience: Beginner
                      • OS: Unknown
                      Re: batch file to run program in another partition
                      « Reply #9 on: January 10, 2012, 03:52:03 PM »
                      The log.txt file is empty.

                      Roger

                      Raven19528



                        Hopeful
                      • Thanked: 30
                        • Computer: Specs
                        • Experience: Experienced
                        • OS: Windows 7
                        Re: batch file to run program in another partition
                        « Reply #10 on: January 10, 2012, 04:41:42 PM »
                        Okay, let's hit some basics. I apologize if these are really base to you, but I would like to make sure we are all on the same page.

                        1. When you type these commands into notepad (or a similar plain text processor), you save it as test.bat (or some name with the .bat extension)

                        2. When you run the batch, you do so by either:
                          a. Start -> Run   "test.bat" OR
                          b. Double-click the file in Windows Explorer window.

                        So long as all of this is correct, it seems very strange that it isn't giving you anything.

                        Try Start -> Run  "cmd"  then type in the script below line by line, and post the log and errorlog.

                        Code: [Select]
                        @echo on
                        c: >>c:\log.txt 2>>c:\errorlog.txt
                        chdir c:\zzz\Precursors >>c:\log.txt 2>>c:\errorlog.txt
                        start d:\stereo\sts.exe >>c:\log.txt 2>>c:\errorlog.txt
                        cd d:\stereo >>c:\log.txt 2>>c:\errorlog.txt
                        exit

                        Thanks, and hopefully we are getting closer.
                        "All things that are
                        Are with more spirit chased than enjoy'd" -Shakespeare

                        rogernh

                          Topic Starter


                          Rookie

                          • Experience: Beginner
                          • OS: Unknown
                          Re: batch file to run program in another partition
                          « Reply #11 on: January 10, 2012, 05:08:09 PM »
                          log.txt says:

                          @echo on
                          c: >>c:\log.txt 2>>c:\errorlog.txt
                          chdir c:\zzz\Precursors >>c:\log.txt 2>>c:\errorlog.txt
                          start d:\stereo\sts.exe >>c:\log.txt 2>>c:\errorlog.txt
                          cd d:\stereo >>c:\log.txt 2>>c:\errorlog.txt
                          exit

                          errorlog.txt is empty

                          Roger

                          Raven19528



                            Hopeful
                          • Thanked: 30
                            • Computer: Specs
                            • Experience: Experienced
                            • OS: Windows 7
                            Re: batch file to run program in another partition
                            « Reply #12 on: January 11, 2012, 11:19:41 AM »
                            Then something is really wrong with your computer. The fact that the redirection is so screwy that it shows everything that was typed in makes me think that there are some really strange things going on with your computer.  The only other thing that could cause this is simple operator error, but if you are following all the steps I gave in my previous post, then that should not be the case.

                            You can try renaming your log.txt file into log.bat, run it, and see what happens. Though at this point I don't expect anything different.

                            Unfortunately at this point, the only way I know to correct any wonky issues with cmd.exe is a full reinstall of the operating system. I just don't understand how cmd.exe can be so messed up but everything else work fine. Once that is done though, please try these steps again and see what you get.
                            "All things that are
                            Are with more spirit chased than enjoy'd" -Shakespeare

                            rogernh

                              Topic Starter


                              Rookie

                              • Experience: Beginner
                              • OS: Unknown
                              Re: batch file to run program in another partition
                              « Reply #13 on: January 11, 2012, 02:35:13 PM »
                              A full reinstall is pretty drastic and I hate losing all my installs.

                              But thanks for trying. I'll just have to live with it.

                              Roger

                              rogernh

                                Topic Starter


                                Rookie

                                • Experience: Beginner
                                • OS: Unknown
                                Re: batch file to run program in another partition
                                « Reply #14 on: January 12, 2012, 08:34:52 AM »
                                One other possibility.

                                C: is on one HD, D: and E: are on another HD

                                Is it possible that STS doesn't know which drive its files are on?

                                DOS used to have a PATH file but XP doesn't as far as I know.

                                Roger