1.

Solve : Help on IF Command in Windows?

Answer»

Hello , I have a requirement whereby I am supposed to convert one unix script into NT.

The script is as follows:

Contents of zyx001f_touch.sh (Unix)

# ***********************************************************
# * script zyx001f_touch.sh                                 *
# ***********************************************************
test ! -f /usr/ftp/TD1/ftpwde/ZYX001F && touch /usr/ftp/TD1/ftpwde/ZYX001F
pwd

As PER this script this will check if there EXISTS a file ZYX001F , if the file does not EXIST then it will create the file in this directory.

Can anyone convert this unix script into NT for me .

Any help will be appreciated.

Thanks and Regards

Arigato.http://ourworld.compuserve.com/homepages/efjohnson/perlwin.htmHello ,

          I could not find out the solution to my problem on the site mentioned by you.

Can anyone translate the script for me in the WINDOWS nt environment.

The script SIMPLY wants to check if t he file ZYX001F exists and if does not exist then it creates new file.


Any help will be appreciated.

Thanks and Regards

Hitesh Desai
Try this:





ECHO OFF
:PROCESS_0
CLS
MD c:\ZYX001F\
if ERRORLEVEL=1 GOTO PROCESS_1
if ERRORLEVEL=0 GOTO PROCESS_2

:PROCESS_1
CLS
ECHO.
ECHO                HotShot - 2004
ECHO   ------------------------------------------
ECHO.
ECHO          The folder "c:\ZYX001F\"
ECHO            was ALREADY created
ECHO.
ECHO   ------------------------------------------
ECHO.
PAUSE
GOTO END

:PROCESS_2
CLS
ECHO.
ECHO                HotShot - 2004
ECHO   ------------------------------------------
ECHO.
ECHO            The folder "c:\ZYX001F\"
ECHO               was created - NEW
ECHO          as it did NOT exist previously
ECHO.
ECHO   ------------------------------------------
ECHO.
PAUSE
GOTO END

:END
EXIT
if exist c:\usr\ftp\td1\ftpwde\zyx001f.* goto present
echo Starting new file > c:\usr\ftp\td1\ftpwde\zyx001f.
echo New file created
pause
goto end
:present
echo File already present
pause
:end


Like this?



Discussion

No Comment Found