Total Commander referencing current path to DOSBox

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
Arghdian
Junior Member
Junior Member
Posts: 7
Joined: 2017-10-05, 09:15 UTC
Location: Poland

Total Commander referencing current path to DOSBox

Post by *Arghdian »

Hello!
I'm in need to run a DOS app in DOSBox but before running it i'd like to mount a currently viewed directory. It's possible to mount a directory before running an app as a parameter of DOSBox but that's where it gets tricky. This is what works:

Code: Select all

Command: d:\directory\DOSBox.exe 
Parameters: d:\directory2\app.exe -c "MOUNT D d:\directory3" 
but it's always mounting the same directory and it helps me in almost nothing, it requires me to jump through many folders to get where I need to. That's what I'd kinda want to work:

Code: Select all

Command: d:\directory\DOSBox.exe 
Parameters: d:\directory2\app.exe -c "MOUNT D %P" 
but it ends up with only app's directory mounted. I've tried %P. and %P/ commands but it still doesn't want to mount currently viewed directory or me. Is there any other way to acomplish it?
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Maybe it doesn't like the trailing backslash inserted by %P (e.g. d:\directory3\).

Try appending a single dot:
Parameters: d:\directory2\app.exe -c "MOUNT D %P."

Btw, if you add a ? to the start of the parameters, you will be able to see and edit the parameters before launch. It may help you to analyze the problem:
Parameters: ?d:\directory2\app.exe -c "MOUNT D %P."
Author of Total Commander
https://www.ghisler.com
Arghdian
Junior Member
Junior Member
Posts: 7
Joined: 2017-10-05, 09:15 UTC
Location: Poland

Post by *Arghdian »

I've already tried using it with a dot and with a slash, it does not mount the directory at all then. I'll try to experiment with editing parameters before launch but I'm open for all suggestions
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

If it is a trailing backslash who breaks things, you can also try escaping it with another backslash:

Code: Select all

d:\directory2\app.exe -c "MOUNT D %P\"
Finally you can use some batch or script that will cut that backslash from path...
User avatar
nsp
Power Member
Power Member
Posts: 1804
Joined: 2005-12-04, 08:39 UTC
Location: Lyon (FRANCE)
Contact:

Post by *nsp »

Arghdian wrote:I've already tried using it with a dot and with a slash, it does not mount the directory at all then. I'll try to experiment with editing parameters before launch but I'm open for all suggestions
Did you tried to start your command in the current folder and only mount "."

Code: Select all

Command: d:\directory\DOSBox.exe
Parameters: d:\directory2\app.exe -c "MOUNT D ."
Start path:%P
if your folder contain spaces you can have also some issues with "quotes" and %P
Arghdian
Junior Member
Junior Member
Posts: 7
Joined: 2017-10-05, 09:15 UTC
Location: Poland

Post by *Arghdian »

nsp wrote:
Arghdian wrote:I've already tried using it with a dot and with a slash, it does not mount the directory at all then. I'll try to experiment with editing parameters before launch but I'm open for all suggestions
Did you tried to start your command in the current folder and only mount "."

Code: Select all

Command: d:\directory\DOSBox.exe
Parameters: d:\directory2\app.exe -c "MOUNT D ."
Start path:%P
if your folder contain spaces you can have also some issues with "quotes" and %P
Okay, that's something that almost works, it mounts the whole C drive as a D drive in DOSBox (and it's weird because I don't have a C drive opened anywhere). It acts this way both in deep folders with spaces and with only the main drive folder opened. Total Commander should give me a currently active tab's path when %P variable is used, right?
User avatar
nsp
Power Member
Power Member
Posts: 1804
Joined: 2005-12-04, 08:39 UTC
Location: Lyon (FRANCE)
Contact:

Post by *nsp »

Arghdian wrote: Okay, that's something that almost works, it mounts the whole C drive as a D drive in DOSBox (and it's weird because I don't have a C drive opened anywhere). It acts this way both in deep folders with spaces and with only the main drive folder opened. Total Commander should give me a currently active tab's path when %P variable is used, right?
You should probably try to make if works from command line and then try find if some limitations are due to dosbox command line length or whatever...
I remember using SUBST to mount long path to a virtual disk and use old pgm from this "drive". SUBST still works in windows 7/8/....10.
You could probably try to make a batch file and run it from TC passing current folder as parameter.

Code: Select all

rem Run dosbox
@echo off 
subst W: "%1%
d:\directory\DOSBox.exe d:\directory2\app.exe -c "MOUNT D  W:"
rem  if dosbox wait for app to finish uncomment next line
REM subst  W: /D 
Arghdian
Junior Member
Junior Member
Posts: 7
Joined: 2017-10-05, 09:15 UTC
Location: Poland

Post by *Arghdian »

nsp wrote:
Arghdian wrote: Okay, that's something that almost works, it mounts the whole C drive as a D drive in DOSBox (and it's weird because I don't have a C drive opened anywhere). It acts this way both in deep folders with spaces and with only the main drive folder opened. Total Commander should give me a currently active tab's path when %P variable is used, right?
You should probably try to make if works from command line and then try find if some limitations are due to dosbox command line length or whatever...
I remember using SUBST to mount long path to a virtual disk and use old pgm from this "drive". SUBST still works in windows 7/8/....10.
You could probably try to make a batch file and run it from TC passing current folder as parameter.

Code: Select all

rem Run dosbox
@echo off 
subst W: "%1%
d:\directory\DOSBox.exe d:\directory2\app.exe -c "MOUNT D  W:"
rem  if dosbox wait for app to finish uncomment next line
REM subst  W: /D 
The script gives me nothing, nothing is mounted. Also, weird thing but "rem" does not comment sections out of a bat file for me, I needed to use "::". Could you please elaborate on passing folder as a parameter? I have no idea how to do this (I have 0 experience in batch files, only some entry level BASIC and C++)
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

I've tried %P with tralinig dot and it works for me:

Code: Select all

Command: D:\Stuff\DOSBox\DOSBox.exe
Parameters: -conf "D:\Stuff\DOSBox\dosbox.conf" -noconsole -noautoexec -c "@echo off" -c "mount D %P."
Arghdian
Junior Member
Junior Member
Posts: 7
Joined: 2017-10-05, 09:15 UTC
Location: Poland

Post by *Arghdian »

MVV wrote:I've tried %P with tralinig dot and it works for me:

Code: Select all

Command: D:\Stuff\DOSBox\DOSBox.exe
Parameters: -conf "D:\Stuff\DOSBox\dosbox.conf" -noconsole -noautoexec -c "@echo off" -c "mount D %P."
Maybe it's something about "@echo off" or "-noautoexec" but it works! But now I have another question and maybe you could help me with it as we are at the topic - is there any way to add parameters to an app starting in DOSBox through TC command line apart from .config file?
User avatar
nsp
Power Member
Power Member
Posts: 1804
Joined: 2005-12-04, 08:39 UTC
Location: Lyon (FRANCE)
Contact:

Post by *nsp »

Arghdian wrote:
nsp wrote:

Code: Select all

:: Run dosbox
@echo off 
subst W: %1
d:\directory\DOSBox.exe d:\directory2\app.exe -c "MOUNT D  W:"
::  if dosbox wait for app to finish uncomment next line
:: subst  W: /D 
The script gives me nothing, nothing is mounted. Also, weird thing but "rem" does not comment sections out of a bat file for me, I needed to use "::". Could you please elaborate on passing folder as a parameter? I have no idea how to do this (I have 0 experience in batch files, only some entry level BASIC and C++)
Are you running on windows ?
AS said, first you have to make it run from command line cmd.exe.
- run the subst command
- launch your dosbox stuff mounting the virtual drive
- see if dosbox wait....
To pass a parameter to a script just add the "%P" in the parameter field of total commander.
from command line just add it after your script name...
// i modified the script code to correct a typo
Arghdian
Junior Member
Junior Member
Posts: 7
Joined: 2017-10-05, 09:15 UTC
Location: Poland

Post by *Arghdian »

nsp wrote:
Arghdian wrote:
nsp wrote:

Code: Select all

:: Run dosbox
@echo off 
subst W: %1
d:\directory\DOSBox.exe d:\directory2\app.exe -c "MOUNT D  W:"
::  if dosbox wait for app to finish uncomment next line
:: subst  W: /D 
The script gives me nothing, nothing is mounted. Also, weird thing but "rem" does not comment sections out of a bat file for me, I needed to use "::". Could you please elaborate on passing folder as a parameter? I have no idea how to do this (I have 0 experience in batch files, only some entry level BASIC and C++)
Are you running on windows ?
AS said, first you have to make it run from command line cmd.exe.
- run the subst command
- launch your dosbox stuff mounting the virtual drive
- see if dosbox wait....
To pass a parameter to a script just add the "%P" in the parameter field of total commander.
from command line just add it after your script name...
// i modified the script code to correct a typo
As I said before, script almost works, it starts DOSBox but nothing is mounted but now cmd.exe gives me "drive have already been mounted through SUBST command" message. I've managed to put all needed commands as parameters and some as autoexec commands (although it looks messy) and start it with a button but there are some display bugs and it's more of a DOSBpx-forum case.
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Arghdian wrote:Maybe it's something about "@echo off" or "-noautoexec" but it works!
Well, -noautoexec only disables executing autoexec commands from [autoexec] section of DOSBox config file, and then autoexec commands are passed one by one using -c parameter. @echo off here disables printing commands before executing them, just as in any batch file.
Arghdian wrote:But now I have another question and maybe you could help me with it as we are at the topic - is there any way to add parameters to an app starting in DOSBox through TC command line apart from .config file?
You see, you can start any number of programs in DOSBox using multiple -c parameters. And you can pass parameters of course, as long as they don't contain double quotes because entire commands should be quoted. You can try my AskParam tool if you want to enter separate parameters in small dialog and pass them to the program, or you can use ? in front of parameter line in TC and edit full DOSBox command line in order to change parameters.

AskParam usage example:

Code: Select all

Command: AskParam.exe
Parameters: /t"echo Wow, I'm started!" /p"Launch in DOSBox:" D:\Stuff\DOSBox\DOSBox.exe -conf "D:\Stuff\DOSBox\dosbox.conf" -noconsole -noautoexec -c "@echo off" -c "mount C C" -c "mount D %P." -c "%%1"
Arghdian
Junior Member
Junior Member
Posts: 7
Joined: 2017-10-05, 09:15 UTC
Location: Poland

Post by *Arghdian »

MVV wrote:
Arghdian wrote:Maybe it's something about "@echo off" or "-noautoexec" but it works!
Well, -noautoexec only disables executing autoexec commands from [autoexec] section of DOSBox config file, and then autoexec commands are passed one by one using -c parameter. @echo off here disables printing commands before executing them, just as in any batch file.
Arghdian wrote:But now I have another question and maybe you could help me with it as we are at the topic - is there any way to add parameters to an app starting in DOSBox through TC command line apart from .config file?
You see, you can start any number of programs in DOSBox using multiple -c parameters. And you can pass parameters of course, as long as they don't contain double quotes because entire commands should be quoted. You can try my AskParam tool if you want to enter separate parameters in small dialog and pass them to the program, or you can use ? in front of parameter line in TC and edit full DOSBox command line in order to change parameters.

AskParam usage example:

Code: Select all

Command: AskParam.exe
Parameters: /t"echo Wow, I'm started!" /p"Launch in DOSBox:" D:\Stuff\DOSBox\DOSBox.exe -conf "D:\Stuff\DOSBox\dosbox.conf" -noconsole -noautoexec -c "@echo off" -c "mount C C" -c "mount D %P." -c "%%1"
Yahoo, I tried messing with multiple commands and it works apart from some graphical glitches but I don't think these are command-relevant. Thank you very much people here!
Post Reply