Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Help on IF Command in Windows  (Read 3128 times)

0 Members and 1 Guest are viewing this topic.

hitcom_2000

  • Guest
Help on IF Command in Windows
« on: October 11, 2004, 01:07:33 AM »
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.

merlin_2

  • Guest

hitcom_2000

  • Guest
Re: Help on IF Command in Windows
« Reply #2 on: October 14, 2004, 01:51:43 AM »
Hello ,

          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

HotShot

  • Guest
Re: Help on IF Command in Windows
« Reply #3 on: November 24, 2004, 06:27:40 AM »
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

MalikTous

  • Guest
Re: Help on IF Command in Windows
« Reply #4 on: November 24, 2004, 01:49:08 PM »
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?