1.

Solve : batch file to run program in another partition?

Answer»

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

RogerFirst, 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.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 Quote from: rogernh on January 10, 2012, 11:18:32 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.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?

RogerCorrection; the full path works in the run window but not in the batch file.

now I'm really confused.

Roger Quote from: rogernh on January 10, 2012, 01:12:20 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.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.

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
The log.txt file is empty.

RogerOkay, 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.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

RogerThen 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.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.

RogerOne 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


Discussion

No Comment Found