#8
Post
by nnnmmm » 01 May 2024 23:32
>What exactly are you looking for, when you write "i will find a detour to find a parent dir name"?
it may be my boring story, but goes something like this
i am nornamlly expecting this way W:\Crysis 2>Crysis2.exe
but this program runs this way W:\Crysis 2\Bin32>Crysis2.exe from its sub
no matter what, i always create Crysis2.bat to support Crysis2.exe
Crysis2.bat contains like
delete cache, log, some savedfiles, may overwrite some settings, and screenshot
and SET /P VAR=INPUT: to select mods and etc
-----------------------------------------------------------
Crysis2.bat will be called by another bacth like !!!!2 Crysis2.bat
!!!!2 Crysis2.bat's file name contains the INFO as to if it is
a dosbox needed, win game or scummVM or other emulators or win programs
i have ~1000 files like Crysis2.bat form and have ~1000 files like !!!!1 Crysis2.bat form
throughout the pc HDDs
what !!!!2 Crysis2.bat should have had only
@ECHO OFF
SET "A1=%~dp0Bin32"
PUSHD "%A1%"
IF EXIST "!emulator - setup.bat" CALL "!emulator - setup.bat"
CALL "%A1%\Crysis2.bat"
but not this way, this was a temp detour, it violates the format, before the number of this kind of ill and mixed format starts to increase, i must correct it
@ECHO OFF
IF /I EXIST "%~dp0LogBackups" RMDIR /s /q "%~dp0LogBackups"
@ECHO OFF
SET "A1=%~dp0Bin32"
PUSHD "%A1%"
IF EXIST "!emulator - setup.bat" CALL "!emulator - setup.bat"
CALL "%A1%\Crysis2.bat"
--------------------------------------------------
since this following one doesnt work in Crysis2.bat and tries to delete other directory, i must do a string manipulation to find the parent dir name, i am capable of doing it but it takes a lot of energy out of me unlike CD ..
SET "AA1=%~dp0"
PUSHD "%AA1%"
CD ..
SET "AA2=%~dp0"
POPD
SET "AA3=%~dp0"
PUSHD "%AA1%"
ECHO %AA1%
ECHO %AA2%
ECHO %AA3%
PAUSE
CLS
IF /I EXIST "%AA2%LogBackups" RMDIR /s /q "%AA2%LogBackups"
----------------------------------------------------
then
!!!!2 Crysis1.bat will be executed by a batch file "central.bat"
central.bat is built with some batch intelligence, it can be run anywhere and finds the 1st parent dir and the 2nd and 3rd layer of the path for IT to make a decision among 10s and 100s and 1000s sub directories(not layers) within it, which will save my clicking and scrolling time and labor otherwise.
and best of all, batch is OS independent, upgrade independent, or it would take 6 months for me in the past to get the ALL settings right, now only takes 10 minutes after installing windows. because nothing is linked or integrated through the explorer in my windows. i used xtree for DOS and now using ztree for windows.
making drive letter, directory name and registry independent with programs is my goal in batch