VOGONS


First post, by d_xiansheng

User metadata
Rank Newbie
Rank
Newbie

Hi, I'm trying to set up an old DOS tool I used to use to be on the SendTo menu using DOSBox. I've been trying to create a batch file to do this. What I have so far is:

dosbox.exe -c "mount D .\nana" -c "mount C %~1" -c "D:\nana.exe C:\%~n1"

The problem is with the second mount command. If the file I am passing as an argument has spaces in it, DOSBox explodes. It would be the same as type "mount C C:\Program Files" in the console when you need "mount C "C:\Program Files""

My question is, is there any way to group strings when using the -c flag like you do using "" within DOSBox itself? You can't just pass extra "" marks on the commandline without corrupting all the arguments. I need to somehow make the contents of %~1 grouped in a way where the mount command will be able to process it once DOSBox starts up.

Any help you can give me would be much appreciated. Thanks.

Reply 1 of 5, by MiniMax

User metadata
Rank Moderator
Rank
Moderator

Check out my name8.3 function in this post: Re: Feature Request: Right click & goto in DOSBox...

DOSBox 60 seconds guide | How to ask questions
_________________
Lenovo M58p | Core 2 Quad Q8400 @ 2.66 GHz | Radeon R7 240 | LG HL-DT-ST DVDRAM GH40N | Fedora 32

Reply 2 of 5, by d_xiansheng

User metadata
Rank Newbie
Rank
Newbie

Doesn't seem to work ... %name83% just ends up empty every time.

Are you able to use this on XP?

I'm trying:

   call :name83 "%*"

cd "%TEMP%"

"C:\Program Files\DOSBox\dosbox.exe" -noconsole -c "mount D .\nana" -c "mount C C:\" -c "C:" -c "D:\nana.exe %name83%%~n1"

:name83
set MeansDirectory=Katalog

pushd "%~1"

for /f "skip=3 tokens=1-3" %%I in ('COMMAND.COM /C DIR') do (
if %%I==%MeansDirectory% (
set name83=%%K
goto unpushd
)
)

:unpushd
popd
goto :EOF

Reply 3 of 5, by MiniMax

User metadata
Rank Moderator
Rank
Moderator

Yes, it works on Windows XP - that is what I have. The problem is most likely the line

set MeansDirectory=Katalog

In my Danish version of Windows, "Katalog" is the word for a Directory. You need to change your script to match the word used in your version of Windows. Do a DIR command from a CMD-prompt and watch the output.

DOSBox 60 seconds guide | How to ask questions
_________________
Lenovo M58p | Core 2 Quad Q8400 @ 2.66 GHz | Radeon R7 240 | LG HL-DT-ST DVDRAM GH40N | Fedora 32

Reply 4 of 5, by d_xiansheng

User metadata
Rank Newbie
Rank
Newbie

Wow, that was a really clever trick.

Just realized one last problem, what about getting the filename in 8.3 format?

Reply 5 of 5, by MiniMax

User metadata
Rank Moderator
Rank
Moderator

You can use a similar technique by scanning for the 8.3 name in the output from DIR /X longfilename.

DOSBox 60 seconds guide | How to ask questions
_________________
Lenovo M58p | Core 2 Quad Q8400 @ 2.66 GHz | Radeon R7 240 | LG HL-DT-ST DVDRAM GH40N | Fedora 32