cmd does not handle directory setting commands or quotation marks correctly

Open forum for end-user questions about Wine. Before asking questions, check out the Wiki as a first step.
Forum Rules
Locked
zaphida
Newbie
Newbie
Posts: 3
Joined: Sun Feb 12, 2023 12:31 am

cmd does not handle directory setting commands or quotation marks correctly

Post by zaphida »

https://github.com/Bladez1992/HardLaunch HardLaunch is a command-line based launcher for the game Hardwar but because cmd is not handling directory setting commands correctly under wine, it does not fully function.
It throws Path not found. errors and displays quotations like so: "What would you like your Local World to be called: " while running under windows this would appear as: What would you like your Local World to be called:
I tried installing the native Windows cmd.exe using winetricks cmd but the behaviour is largely the same but worse: text from a previous menu screen is not being cleared.
Bladez1992
Newbie
Newbie
Posts: 1
Joined: Thu Mar 16, 2023 2:34 am

Re: cmd does not handle directory setting commands or quotation marks correctly

Post by Bladez1992 »

After extensive testing between the two of us, it does seem as though Wine is mishandling directory management commands (cd, ~dp) and quotations in Windows batch scripts
I have tested my batch even on Windows XP, and it works there.
When running through Wine, HardLaunch gives file not found errors on directory commands and shows quotation marks where they should not be visible (and are not visible on a Windows install)

Also, cls and timeout do not seem to work at all under Wine, at least when run through a Windows batch file

An example of a section of my code that doesn't seem to work:
(Save this as a .bat and run through Wine)

Code: Select all

@ECHO off
mode con: cols=100 lines=44
title HardLaunch by Bladez1992 (v1.1.2.0)
color 0c

REM --------------------Main Menu----------------------------------------------------------------------------

:main_menu
cls
ECHO			        HardLaunch
ECHO			         v1.1.2.0
ECHO			      By Bladez1992
ECHO 1.  Create A New Local World					 
ECHO 2.  Create A New Network Game					 
ECHO 3.  Create A New Dedicated Server
ECHO -------------------------------------------
ECHO 4.  Load A Local World						 
ECHO 5.  Load A Network Game						 
ECHO 6.  Load A Dedicated Server				 
ECHO 7. Exit HardLaunch					 
set choice=
set /p choice=Type the number of your selection: 
if not '%choice%'=='' set choice=%choice:~0,2%
if '%choice%'=='1' goto newworld
if '%choice%'=='2' goto newnetworld
if '%choice%'=='3' goto newdedworld
if '%choice%'=='4' goto loadworld
if '%choice%'=='5' goto loadnetworld
if '%choice%'=='6' goto loaddedworld
if '%choice%'=='7' goto end
ECHO "%choice%" is invalid, choose something on the list!
goto main_menu

REM --------------------World/Game/Network Commands----------------------------------------------------------

:newworld
set /p LocalSaveName="What would you like your Local World to be called: "
@echo off
set "currentDirectory=%cd%"
start HardwarW.exe /t:new "%cd%\Savegames\%LocalSaveName%.sav"
goto end
:newnetworld
set /p NetSaveName="What would you like your Network Game to be called: "
@echo off
set "currentDirectory=%cd%"
start HardwarW.exe /t:newserver "%cd%\Savegames\%NetSaveName%.sav"
goto end
:newdedworld
set /p DedSaveName="What would you like your Dedicated Server to be called: "
@echo off
set "currentDirectory=%cd%"
start HardwarW.exe /t:newded "%cd%\Savegames\%DedSaveName%.sav"
goto end
:loadworld
set /p LoadLocalSaveName="Type your Local World's name to load it: "
@echo off
set "currentDirectory=%cd%"
start HardwarW.exe /t:load "%cd%\Savegames\%LoadLocalSaveName%.sav"
goto end
:loadnetworld
set /p LoadNetSaveName="Type your Network Game's name to load it: "
@echo off
set "currentDirectory=%cd%"
start HardwarW.exe /t:loadserver "%cd%\Savegames\%LoadNetSaveName%.sav"
goto end
:loaddedworld
set /p LoadDedSaveName="Type your Dedicated Server's name to load it: "
@echo off
set "currentDirectory=%cd%"
start HardwarW.exe /t:loadded "%cd%\Savegames\%LoadDedSaveName%.sav"
goto end

:end
timeout /t 10
exit
Last edited by Bladez1992 on Thu Mar 16, 2023 2:55 am, edited 5 times in total.
Locked