Qbasicnews.com
February 26, 2020, 02:21:39 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: 1 [2] 3 4
  Print  
Author Topic: PATH doesn't work within a DOS SHELL --- Why?  (Read 9596 times)
Z!re
*/-\*
*****
Posts: 4599


« Reply #15 on: February 15, 2004, 12:10:05 AM »

See my previus post, it works on w98
Logged
TheBigBasicQ
*/-\*
*****
Posts: 4550



WWW
« Reply #16 on: February 15, 2004, 04:54:01 AM »

Ok, I think I understood what your problem is. The DOS shell accepts the PATH statement if you just type it on the command line of your current DOS Shell. But it doesnt work if you make a batch file to do it for you.

Could you please post the batch file?
Logged
Antoni Gual
Na_th_an
*****
Posts: 1434



WWW
« Reply #17 on: February 15, 2004, 07:30:02 AM »

As you can see if you run my code, a batch file can change your path while you're in a shell open from a QB program.

Probably the utility you use is filtering the commands you issue and does'nt allow path to work...
Logged

Antoni
TheBigBasicQ
*/-\*
*****
Posts: 4550



WWW
« Reply #18 on: February 15, 2004, 02:44:35 PM »

Frankly, moneo the explanation you've posted is quite confusing =(.
Logged
na_th_an
*/-\*
*****
Posts: 8244



WWW
« Reply #19 on: February 15, 2004, 03:38:48 PM »

And I think it is not.

Moneo, I have recreated your steps and have met the same thing. But I need to know something to get to a conclusion:

¿What's your exact PATH line in the BAT file?
Logged

SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
TheBigBasicQ
*/-\*
*****
Posts: 4550



WWW
« Reply #20 on: February 15, 2004, 04:49:40 PM »

Which app is he using anyway?
Logged
Moneo
Na_th_an
*****
Posts: 1971


« Reply #21 on: February 15, 2004, 10:05:05 PM »

Here's the exact batchfile referred to:
Code:
path=c:\
type tt13.bas
echo qwert

The TYPE and ECHO commands are just to see if the batchfile executed ok. They  do.
The PATH that exists when you get into the DOS Shell is quite long.

THEBIGBASICO: I sincerely have tried to explain this as best as possible. What do you mean by "Which app am I using"?

ANTONI: I doubt if the utility program, which does the DOS Shell, can exercise any control as to what gets executed. Besides, forget the utility for a minute, the same thing happens when I run the old interpreted BASIC and type in a direct command of SHELL.
*****
Logged
na_th_an
*/-\*
*****
Posts: 8244



WWW
« Reply #22 on: February 15, 2004, 10:32:35 PM »

Well, that disproves my theory, so I don't have a clue on what's happening.

But I've thought about a walkaround: make a batch file which sets the PATH and then call your application. Run that BAT file instead of the application and you'll be guaranteed to have a working PATH environment variable when you open a MSDOS shell from within your application:

Code:
set path=c:\whatever;c:\anotherthing;c:\bleh
myprog.exe
Logged

SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Moneo
Na_th_an
*****
Posts: 1971


« Reply #23 on: February 15, 2004, 11:47:11 PM »

Nathan,
I don't know what you mean by "my application".
*****
Logged
na_th_an
*/-\*
*****
Posts: 8244



WWW
« Reply #24 on: February 16, 2004, 01:03:09 AM »

The program you are shelling from:

Quote from: "Moneo"
I get into this shell from a utility program which has an option "go to DOS".
Logged

SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Antoni Gual
Na_th_an
*****
Posts: 1434



WWW
« Reply #25 on: February 16, 2004, 08:02:29 AM »

Moneo:
You have said the magic word: "it is rather long"
DOS has a size limit for path, if you try to go beyond it, PATH commands are not accepted.
You should try to keep your base path to a minimum, adding other paths only the time to execute a program..

About the program filtering shell commands, it is one thing old AutoCad 10 for DOS was able to do. I suppose they loaded their own Command.com.. After all, modifying paths while running a program could be dangerous for the program.
Logged

Antoni
Moneo
Na_th_an
*****
Posts: 1971


« Reply #26 on: February 16, 2004, 07:02:06 PM »

Antoni,
The original path was long, but the path that I'm trying to change to from the batchfile is short (C:\).
*****
Logged
xhantt
Member
*
Posts: 90



« Reply #27 on: February 16, 2004, 08:50:07 PM »

I dont know if i understand it at all. I try to explain what i suppouse is happen as best as i can.

Suppouse you have program A, a BAT file B.

Now you start from command.com (this will be the parent shell P), you call A, and then make a DOS-Shell (this is another instance of command.com and is Q), and execute B file.

Any changes that make B to the environment will be lost.

P is the grandfather, A is the father, and Q is the child. B modify the Q environment, and this changes will be lost when you type EXIT and return to A.

If you want that A modify P environment, you have to examine A PSP a find where is P PSP (who is A parent), and then examine P PSP to find the environment.

I hope to be as clear as possible.
Logged
na_th_an
*/-\*
*****
Posts: 8244



WWW
« Reply #28 on: February 16, 2004, 09:58:32 PM »

No, that is not what's happening.

He opens his application, goes to a dos Shell, calls a BAT file containing a PATH statement, and then (before exiting the dos shell) he checks if the PATH has changed and it hasn't.

That's the problem. And that happens to me as well, I've tried it.

What I suggested is that he created a BATch file which set the PATH and then launched the application. That way, when he opened the dos Shell from within the application, the PATH would have the correct value. This is a walk-around, and it has worked for me. I don't know if that worked for him, I didn't get any reply.
Logged

SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Moneo
Na_th_an
*****
Posts: 1971


« Reply #29 on: February 17, 2004, 12:14:05 AM »

Nathan,
Ok, I tried your theory.

1) I created a batchfile which set the path to C:\MONEO.

2) I executed above batchfile from Windows by going to "My Computer", selecting the above batch file, and double click to run it. The screen went black for a second so it must have run it.

3) Again from "My Computer", I select what you call "my application" which is really an old version of the LIST utility. I double click to run it, pick a filename, Alt-G to go to DOS.

4) Now from the command-line of this DOS Shell, I do a PATH. Nope, it's the same old path as ever, not c:\moneo.

5) I think the reason that the up-front batchfile doesn't work is because I'm launching this "application" from Windows, which is exactly the idea behind all this. I need to do it this way.

6) I already tried to get into DOS from Windows via "cmd", but that generates an initial DOS Shell. Then, when I generate the second DOS Shell from my "application"; i.e. the LIST program, hardly anything works from the command-line.

You know, the reason I want to change the path, is not to have to do it manually --- it's not that long, so I guess I'll just do it manually every time. It just bothers me that this whole batchfile business doesn't work.
*****
Logged
Pages: 1 [2] 3 4
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!