Computing.Net > Forums > Disk Operating System > Help with bat file

Help with bat file

Reply to Message Icon

Original Message
Name: Eduardo
Date: August 15, 2002 at 05:12:27 Pacific
Subject: Help with bat file
Comment:

How do I make a bat that asks the user what
file to render and what ini file to use?

This is the command to use to render in povray 3.1
.............................................
POVRAY +Ifiletorender.pov initouse.ini -D


Report Offensive Message For Removal


Response Number 1
Name: Secret_Doom
Date: August 15, 2002 at 10:18:54 Pacific
Subject: Help with bat file
Reply: (edit)

You could make a batch file where the sintax would be:

filename.bat file_to_render ini_file
Example:
filename.bat filetorender.pov initouse.ini

On inside the batch file, you would use %1 and %2, which represent the first and second parameters passed to the batch file. It would be also good to add a sintax help. Something like this:

@echo off
:: Check for sintax errors
if "%2"=="" for %%? in (echo goto:sintax) do %%? Missing parameter
if not "%3"=="" for %%? in (echo goto:sintax) do %%? Excess of parameters - %3
if not exist %1 for %%? in (echo goto:sintax) do %%? Invalid filename - %1
if not exist %2 for %%? in (echo goto:sintax) do %%? Invalid filename - %2
:: If sintax is valid (both parameters
:: where stated and both exist), execute
:: the command
POVRAY +I%1 %2 -D
goto eof
:: If there's a sintax error, display
:: a help message
:sintax
echo.
echo Sintax: %0 file_to_render ini_file
echo Example: %0 rend.pov start.ini
echo.
:eof

Watch out for line wrapping!

Second solution: if you want something like "Type file to render and hit enter", see my FAQ:

FAQ #06 - Get user input
http://www.batch.hpg.com.br/index.htm#06

-- Leonardo Pignataro - Secret_Doom --

secret_doom@hotmail.com
www.batch.hpg.com.br


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Help with bat file

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software




How often do you use Computing.Net?

Every Day
Once a Week
Once a Month
This Is My First Time!


View Results

Poll Finishes In 3 Days.
Discuss in The Lounge