IF Statement
Posted: 22 May 2010 13:45
From this previous code i have written i want to add and if statement:
I want the program to check if the file AddItemCode.txt exists and if it does then make the code go to AddItemCode2.txt and if it doesn't exist create it. Is this possible?
Code: Select all
@echo off
cls
title Java Code Generator
echo An example of an item number would be: 995
set /p itemNumber=Please type the item number here:
pause
cls
echo The number of items can range from 1 to 999999999 in most cases.
set /p numberOfItem=Please type the number of that item here:
echo addItem(%itemNumber%,%numberOfItem%); >> AddItemCode.txt
pause
cls
echo Your code has been place in a .txt file named AddItemCode.txt. You will find this file in the directory this program is in.
pause
cls
start AddItemCode.txt
echo The file has been opened.
pause
exit
I want the program to check if the file AddItemCode.txt exists and if it does then make the code go to AddItemCode2.txt and if it doesn't exist create it. Is this possible?