Change & run

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
lthnhvvn
Posts: 2
Joined: 07 Oct 2014 17:27

Change & run

#1 Post by lthnhvvn » 07 Oct 2014 17:44

Hi Friends,
Please can any one help to create scrip to change folder (this code run on windows but cann't run ms-dos)

Example:
@echo off
if exist c:\test\s goto s5

:s5
if exist c:\test\s5 (goto s7) else (
start 5
goto end
)

:s7
if exist c:\test\s7 (goto sv8) else (
start 7
goto end
)

:sv8
if exist c:\test\sv8 (goto sv12) else (
start sv8
goto end
)

:sv12
if exist c:\test\sv12 (
start setup
goto end
) else (
start sv12
goto end
)

:end
========================================
----------8.bat----------
@echo off
ren s s5
ren s8 s
cls

----------7.bat----------
@echo off
ren s s7
ren s8 s
cls

----------sv8.bat----------
@echo off
ren s sv8
ren s8 s
cls

----------sv12.bat----------
@echo off
ren s sv12
ren s8 s
cls

----------setup.bat----------
@echo Folder exist

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Change & run

#2 Post by foxidrive » 07 Oct 2014 17:49

It helps to describe what you want to do.

ShadowThief
Expert
Posts: 1167
Joined: 06 Sep 2013 21:28
Location: Virginia, United States

Re: Change & run

#3 Post by ShadowThief » 07 Oct 2014 18:08

I get the impression that he wants to port the script to MS-DOS 6.22

ShadowThief
Expert
Posts: 1167
Joined: 06 Sep 2013 21:28
Location: Virginia, United States

Re: Change & run

#4 Post by ShadowThief » 07 Oct 2014 18:57

If you do want the script edited to work in DOS, try this.

Code: Select all

@echo off
REM Main.bat

if exist C:\test\s\nul goto s5
if not exist C:\test\s\nul goto end

:s5
if exist C:\test\s5\nul goto s7
if not exist C:\test\s5\nul call 5.bat
goto end

:s7
if exist C:\test\s7\nul goto sv8
if not exist C:\test\s7\nul call 7.bat
goto end

:sv8
if exist C:\test\sv8\nul goto sv12
if not exist C:\test\sv8\nul call sv8.bat
goto end

:sv12
if exist C:\test\sv12\nul call setup.bat
if not exist C:\test\sv12\nul call sv12.bat

:end


Code: Select all

@echo off
REM 5.bat
move s s5
move s8 s
cls

Code: Select all

@echo off
REM 7.bat
move s s7
move s8 s
cls

Code: Select all

@echo off
REM sv8.bat
move s sv8
move s8 s
cls

Code: Select all

@echo off
REM sv12.bat
move s sv12
move s8 s
cls

Code: Select all

@echo Folder exists.
REM setup.bat

lthnhvvn
Posts: 2
Joined: 07 Oct 2014 17:27

Re: Change & run

#5 Post by lthnhvvn » 08 Oct 2014 11:47

All your codes worked great.
Thanks again!


i want compiled code to application
EX:
i have five folder (s;s7;s8;sv8;sv12)

in this folder s5 have file s5.txt
in this folder s7 have file s7.txt
in this folder s8 have file s8.txt
in this folder sv8 have file sv8.txt
in this folder sv12 have file sv12.txt

application.exe -s5 (find & change folder s to corect folder & change folder s5 to s. If s5 not exist call setup.bat)
application.exe -s7 (find & change folder s to corect folder & change folder s7 to s. If s7 not exist call setup.bat)
application.exe -s8 (find & change folder s to corect folder & change folder s8 to s. If s8 not exist call setup.bat)
application.exe -sv8 (find & change folder s to corect folder & change folder sv8 to s. If sv8 not exist call setup.bat)
application.exe -sv12 (find & change folder s to corect folder & change folder sv12 to s. If sv12 not exist call setup.bat)

Post Reply