Home / Microsoft / Microsoft DOS / batch file to run program in another partition
0 Members and 2 Guests are viewing this topic. « previous next »
Pages: 1 2 3 4 [All] - (Bottom) Print
Author Topic: batch file to run program in another partition  (Read 710 times)
rogernh
Topic Starter
Rookie



Posts: 23

Experience: Beginner
OS: Unknown

« 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
IP logged
Raven19528
Hopeful



Thanked: 29
Posts: 284

Computer: Specs
Experience: Experienced
OS: Windows 7



« 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.
IP logged

"All things that are
Are with more spirit chased than enjoy'd" -Shakespeare
rogernh
Topic Starter
Rookie



Posts: 23

Experience: Beginner
OS: Unknown

« 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
IP logged
Raven19528
Hopeful



Thanked: 29
Posts: 284

Computer: Specs
Experience: Experienced
OS: Windows 7



« 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.
IP logged

"All things that are
Are with more spirit chased than enjoy'd" -Shakespeare
rogernh
Topic Starter
Rookie



Posts: 23

Experience: Beginner
OS: Unknown

« 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
IP logged
rogernh
Topic Starter
Rookie



Posts: 23

Experience: Beginner
OS: Unknown

« 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
IP logged
Raven19528
Hopeful



Thanked: 29
Posts: 284

Computer: Specs
Experience: Experienced
OS: Windows 7



« 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.
IP logged

"All things that are
Are with more spirit chased than enjoy'd" -Shakespeare
rogernh
Topic Starter
Rookie



Posts: 23

Experience: Beginner
OS: Unknown

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

IP logged
Raven19528
Hopeful



Thanked: 29
Posts: 284

Computer: Specs
Experience: Experienced
OS: Windows 7



« 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
IP logged

"All things that are
Are with more spirit chased than enjoy'd" -Shakespeare
rogernh
Topic Starter
Rookie



Posts: 23

Experience: Beginner
OS: Unknown

« Reply #9 on: January 10, 2012, 03:52:03 PM »

The log.txt file is empty.

Roger
IP logged
Raven19528
Hopeful



Thanked: 29
Posts: 284

Computer: Specs
Experience: Experienced
OS: Windows 7



« 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.
IP logged

"All things that are
Are with more spirit chased than enjoy'd" -Shakespeare
rogernh
Topic Starter
Rookie



Posts: 23

Experience: Beginner
OS: Unknown

« 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
IP logged
Raven19528
Hopeful



Thanked: 29
Posts: 284

Computer: Specs
Experience: Experienced
OS: Windows 7



« 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.
IP logged

"All things that are
Are with more spirit chased than enjoy'd" -Shakespeare
rogernh
Topic Starter
Rookie



Posts: 23

Experience: Beginner
OS: Unknown

« 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
IP logged
rogernh
Topic Starter
Rookie



Posts: 23

Experience: Beginner
OS: Unknown

« 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
IP logged
Salmon Trout
Sage



Thanked: 546
Posts: 7,950

Computer: Specs
Experience: Beginner
OS: Unknown

1
« Reply #15 on: January 12, 2012, 10:24:21 AM »

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

It's not a file, it's an environment variable, and XP does have it, as does every version of Windows. But you have spotted the problem, I believe.

OP needs to type either

PATH (then press Enter)

or

echo %path% (then press Enter)

and let us know the results, because if CD comes up as an unknown commmand then his %Path% variable is probably screwed up.


« Last Edit: January 12, 2012, 10:34:48 AM by Salmon Trout » IP logged


Proud to be European
Raven19528
Hopeful



Thanked: 29
Posts: 284

Computer: Specs
Experience: Experienced
OS: Windows 7



« Reply #16 on: January 12, 2012, 10:39:29 AM »

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

Have you tried "path /?", because this is what I get from it:

Code: [Select]
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\Raven19528>path /?
Displays or sets a search path for executable files.

PATH [[drive:]path[;...][;%PATH%]
PATH ;

Type PATH ; to clear all search-path settings and direct cmd.exe to search
only in the current directory.
Type PATH without parameters to display the current path.
Including %PATH% in the new path setting causes the old path to be
appended to the new setting.

C:\Users\Raven19528>

So it is definitely possible to set the path. The problem doesn't seem to be the path or anything like that though, as the batch file was essentially copying itself into the log file instead of outputing only certain lines and errors to the log files. Path variables wouldn't have anything to do with the output. I most often see this kind of problem being user error, but since I described those steps in fairly good detail, I suspect that there is something much more involved that is messing things up. Of course, if no commands are able to be found in the path environment, then everything should produce a "Bad command or file name" error and that should be what we see in the error log.
IP logged

"All things that are
Are with more spirit chased than enjoy'd" -Shakespeare
rogernh
Topic Starter
Rookie



Posts: 23

Experience: Beginner
OS: Unknown

« Reply #17 on: January 12, 2012, 10:48:04 AM »

Entering path in the run window gets a "file not found" error.

Entering echo %path% gets "echo not found" error

I got around the problem by putting sts.exe on the C: drive. It can find the other drive from there. The problem seems to be that it can't find its configuration files if they're on the E: partition

Roger
IP logged
rogernh
Topic Starter
Rookie



Posts: 23

Experience: Beginner
OS: Unknown

« Reply #18 on: January 12, 2012, 11:03:43 AM »

Correction; I was doing this wrong. You must type cmd in the run window to get the command line window.

Entering path there gives the response desired as does the echo %path% command. And of course sts.exe was not in the path.

I think it's solved.

Roger
IP logged
Salmon Trout
Sage



Thanked: 546
Posts: 7,950

Computer: Specs
Experience: Beginner
OS: Unknown

1
« Reply #19 on: January 12, 2012, 11:22:36 AM »

Entering path in the run window gets a "file not found" error.

Entering echo %path% gets "echo not found" error


This is XP, right? Go to Control Panel - System - Advanced, click the "Environment Variables" button, and see what is showing in the lower pane (titled "System Variables") for the Path variable. The default value for this is:

Code: [Select]
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem
There may be other values appended or prepended, but you should see at least the above folder paths.

If it is empty then click Edit and paste the above in and click OK repeatedly to get right out back to Control Panel and then reboot.

If it is not empty click Edit and highlight the whole string and copy and paste it here.



IP logged


Proud to be European
Salmon Trout
Sage



Thanked: 546
Posts: 7,950

Computer: Specs
Experience: Beginner
OS: Unknown

1
« Reply #20 on: January 12, 2012, 11:24:03 AM »

Correction; I was doing this wrong. You must type cmd in the run window to get the command line window.

Entering path there gives the response desired as does the echo %path% command. And of course sts.exe was not in the path.

I think it's solved.

Roger

The path variable is a list of folders, separated by semicolons, so no exe file is going to be listed in it. Did you mean the folder in which sts.exe is located?

IP logged


Proud to be European
rogernh
Topic Starter
Rookie



Posts: 23

Experience: Beginner
OS: Unknown

« Reply #21 on: January 12, 2012, 11:48:02 AM »

Yes.

I haven't used the path statement for 25 years.

Roger
IP logged
Salmon Trout
Sage



Thanked: 546
Posts: 7,950

Computer: Specs
Experience: Beginner
OS: Unknown

1
« Reply #22 on: January 12, 2012, 11:52:20 AM »

I haven't used the path statement for 25 years.

Then it's time you brushed up a bit...


IP logged


Proud to be European
patio
Moderator
Genius



Thanked: 1069
Posts: 11,351

Experience: Beginner
OS: Windows 7


Maud' Dib

« Reply #23 on: January 12, 2012, 12:17:32 PM »

In a nutshell all locations required to run the app need to exist in the Path...then adjust the .bat file accordingly...
IP logged

   
"
All generalizations are false, including this one.  "
rogernh
Topic Starter
Rookie



Posts: 23

Experience: Beginner
OS: Unknown

« Reply #24 on: January 12, 2012, 08:06:16 PM »

I thought it was fixed once I found the PATH and added the sts.exe folder.

But NOOOOO!

Not only that, the program to set operating variables work but have no effect on sts itself.

I ran Avast! but found no viruses.

I think it's haunted!

Roger
IP logged
rogernh
Topic Starter
Rookie



Posts: 23

Experience: Beginner
OS: Unknown

« Reply #25 on: January 13, 2012, 11:42:49 AM »

Solved at last!

The problem was not in dos or the path. It was in sts itself. It seems there is a 600 file limit to sts and my C: drive has a LOT more files than that.

Sts couldn't find it's config file. Once I moved the whole folder to another, less crowded, partition, all is well.

Thanks for trying to help. Sorry I misled you.

Roger

IP logged
Salmon Trout
Sage



Thanked: 546
Posts: 7,950

Computer: Specs
Experience: Beginner
OS: Unknown

1
« Reply #26 on: January 13, 2012, 11:55:28 AM »

Stereo Shell was a Midnight Commander clone, I thought it became obsolete (=was abandoned) around about 1989 because it crashed with a divide-by-zero error on any CPU later than the 80386. It sounds like it works after a fashion in a 16 bit virtual machine on Win32 though. I guess it might be fun to run old software, but computers and operating systems have moved on a bit in the last quarter century.

IP logged


Proud to be European
Squashman
Hopeful



Thanked: 25
Posts: 341

Experience: Experienced
OS: Other



« Reply #27 on: January 13, 2012, 12:47:46 PM »

I would think there is a lot better File Managers today than an old version of Stereo Shell.
IP logged
rogernh
Topic Starter
Rookie



Posts: 23

Experience: Beginner
OS: Unknown

« Reply #28 on: January 13, 2012, 12:52:42 PM »

It was abandoned back then but not because it crashed anything.

I've used it on all my computers because it works better than anything else I could find.

Windows drag and drop is much less convenient (to me) than sts's method of keypresses.

Roger
IP logged
patio
Moderator
Genius



Thanked: 1069
Posts: 11,351

Experience: Beginner
OS: Windows 7


Maud' Dib

« Reply #29 on: January 13, 2012, 01:04:30 PM »

XTreeGold...or as Salmon mentioned Midnight Commander...
IP logged

   
"
All generalizations are false, including this one.  "
Salmon Trout
Sage



Thanked: 546
Posts: 7,950

Computer: Specs
Experience: Beginner
OS: Unknown

1
« Reply #30 on: January 13, 2012, 01:08:48 PM »

I found two independent reports that the then current Stereo Shell caused a divide-by-zero error on the first 486 computers... maybe they fixed it. Can it handle long filenames?

IP logged


Proud to be European
rogernh
Topic Starter
Rookie



Posts: 23

Experience: Beginner
OS: Unknown

« Reply #31 on: January 13, 2012, 01:25:33 PM »

Yes, it knows about them but won't display them. longfilename.dat will display as longfi~1.dat

Roger
IP logged
Squashman
Hopeful



Thanked: 25
Posts: 341

Experience: Experienced
OS: Other



« Reply #32 on: January 13, 2012, 01:29:08 PM »

Yes, it knows about them but won't display them. longfilename.dat will display as longfi~1.dat

Roger
That's a deal killer form me right there.
IP logged
rogernh
Topic Starter
Rookie



Posts: 23

Experience: Beginner
OS: Unknown

« Reply #33 on: January 13, 2012, 02:32:14 PM »

That's ok.

You can't get sts anymore anyway.

Roger
IP logged
Squashman
Hopeful



Thanked: 25
Posts: 341

Experience: Experienced
OS: Other



« Reply #34 on: January 13, 2012, 07:08:46 PM »

That's ok.

You can't get sts anymore anyway.

Roger
really. Why did I find it for download when I Google searched for it.
IP logged
patio
Moderator
Genius



Thanked: 1069
Posts: 11,351

Experience: Beginner
OS: Windows 7


Maud' Dib

« Reply #35 on: January 13, 2012, 07:34:13 PM »

The real issue here is you are stubbornly using an older app and trying to get it to run on a newer OS when better more efficient apps have meanwhile been written...
IP logged

   
"
All generalizations are false, including this one.  "
rogernh
Topic Starter
Rookie



Posts: 23

Experience: Beginner
OS: Unknown

« Reply #36 on: January 13, 2012, 08:24:57 PM »

squashman, did you try the link? The ones I found were broken.

patio, I've tried the newer ones and didn't like them. And sts works just fine now. The problems were just in getting the parameters set right.

Roger
IP logged
rogernh
Topic Starter
Rookie



Posts: 23

Experience: Beginner
OS: Unknown

« Reply #37 on: January 13, 2012, 08:27:05 PM »

patiol

Strange criticism from a board dedicated to DOS!

Roger
IP logged
patio
Moderator
Genius



Thanked: 1069
Posts: 11,351

Experience: Beginner
OS: Windows 7


Maud' Dib

« Reply #38 on: January 13, 2012, 08:37:56 PM »

I lobbied for it to be re-named Command...but was out-voted.
And i do respect your passion for the old apps...i was simply making an observation.

Meanwhile did you try XTreeGold ? ?
IP logged

   
"
All generalizations are false, including this one.  "
rogernh
Topic Starter
Rookie



Posts: 23

Experience: Beginner
OS: Unknown

« Reply #39 on: January 13, 2012, 08:52:52 PM »

patio;

No, I think it was a for-pay program but I did find xplorer2.lite which is very similar to sts.

I've been thinking of making my own. I did that for the Sinclair QL. But it isn't necessary since I got the kinks out of sts or rather out of XP setup.

Roger
IP logged
Squashman
Hopeful



Thanked: 25
Posts: 341

Experience: Experienced
OS: Other



« Reply #40 on: January 13, 2012, 10:26:59 PM »

squashman, did you try the link? The ones I found were broken.

patio, I've tried the newer ones and didn't like them. And sts works just fine now. The problems were just in getting the parameters set right.

Roger
Downloaded it at work today before you even mentioned it not being available.
IP logged
Salmon Trout
Sage



Thanked: 546
Posts: 7,950

Computer: Specs
Experience: Beginner
OS: Unknown

1
« Reply #41 on: January 14, 2012, 01:05:30 AM »

I've been thinking of making my own. I did that for the Sinclair QL.

I used a QL from 1985 to 1992. Great little machine.
IP logged


Proud to be European
rogernh
Topic Starter
Rookie



Posts: 23

Experience: Beginner
OS: Unknown

« Reply #42 on: January 14, 2012, 07:03:14 AM »

Yes the QL was ahead of its' time. I tried to be the Kansas distributor but the first question was always "Is it IBM compatible?"

I still have one in the original box plus a bunch of tapes for it.

Roger
IP logged
rogernh
Topic Starter
Rookie



Posts: 23

Experience: Beginner
OS: Unknown

« Reply #43 on: January 14, 2012, 07:44:36 AM »

squashman, you're right! I did find it online much to my surprise.

I've looked for it before without success but found it by searching for sts_410.zip

Roger
IP logged
Salmon Trout
Sage



Thanked: 546
Posts: 7,950

Computer: Specs
Experience: Beginner
OS: Unknown

1
« Reply #44 on: January 14, 2012, 08:01:04 AM »

I vividly remember the SuperBASIC compiler written by a guy called Freddy Vacha (I met him at a computer fair). It came with a software protection device called a "Lenslok". This was a kind of eyepiece with a row of vertical plastic prisms. Before the compiler would start, a random code was displayed on the screen, which was scrambled. If you looked through the Lenslok you could see the code and type it in, allowing access. I believe a number of games of that era on various platforms used it too. My friend and I were developing a circuit simulator (like SPICE) for the QL (well, he had written it for the ZX Spectrum and I ws rewriting it in QL SuperBASIC). We could only afford one copy of the compiler so therefore only had one Lenslok between us. I soon found that by squinting at the screen I could decipher the code without the Lenslok. I told Freddy this and he said he had decided to dump it as it was useless.
IP logged


Proud to be European
rogernh
Topic Starter
Rookie



Posts: 23

Experience: Beginner
OS: Unknown

« Reply #45 on: January 14, 2012, 08:18:32 AM »

Salmon Trout: that's the disadvantage of being a loner. I missed out on fun stuff like that.

Roger
IP logged
Squashman
Hopeful



Thanked: 25
Posts: 341

Experience: Experienced
OS: Other



« Reply #46 on: January 14, 2012, 10:15:19 AM »

squashman, you're right! I did find it online much to my surprise.

I've looked for it before without success but found it by searching for sts_410.zip

Roger
If I recall all I searched for was stereo shell.
IP logged
Pages: 1 2 3 4 [All] - (Top) Print 
Home / Microsoft / Microsoft DOS / batch file to run program in another partition « previous next »
 


Login with username, password and session length

Old Forum Search | Forum Rules
Copyright © 2010 Computer Hope ® All rights reserved.
Powered by SMF 2.0 RC3 | SMF © 2006–2010, Simple Machines LLC
Page created in 0.171 seconds with 19 queries.