Create a script to compile my inputs and run

Microsoft Windows 7 ultimate 32-bit
September 8, 2010 at 07:20:02
Specs: Windows 7 Ultimate, Centrino Duo / 2GB
Hi all,

On a daily basis I have to import serveral csv files into our discovery program (TADDM) using the command line reference:

loadscope -u <username> -p <password> -s <scopename> load <d:\xxx\file.csv>

Is there an easy way I can script this so that I can run a batch file which will:

1. Prompt for the username
2. Prompt for the password
3. Prompt for the scope name we want to use
4. Ask for the location and/or name of the csv file to be imported

then compile and run the command line as stated above using the inputed data?

Thanks in advance,

See More: Create a script to compile my inputs and run

Report •

September 8, 2010 at 10:54:07
To do exactly as you've asked - try this:

@echo off
Echo Please enter the required information below
set /p uname=Please enter the username:
set /p pass=Please enter the password:
set /p scpn=Please enter the scopename:
set /p loc=Please enter the path for the csv file:
dir %loc% >nul
IF %errorlevel% neq 0 goto fnf

loadscope -u %uname% -p %pass% -s %scpn% load "%loc%"
Echo File (%loc%) not found, please try again.
goto fne

The key to making this work is in assigning variables, hopefully this helps to make that process clear. From here, I would suggest doing some error checking (i.e making sure the file exists at the path entered or that the command returns the expected result) I've included a few lines to check the path that's entered and make sure the file exists before continuing. To remove this just delete the bold lines.

Report •
Related Solutions

Ask Question