1 Reply Latest reply on Jan 13, 2013 1:46 AM by BKBK

    Passing variables to command line script

    FlintHosts.co.uk

      I have the following script that is meant to create a mysql database on a remote server using values passed into it:-

      set arg1=\\192.168.0.254\e$\Program Files\MySQL\MySQL Server 5.5\bin  set arg2=192.168.0.254  set arg3=%1    echo %arg1%  echo %arg2%  echo %arg3%    pushd %arg1%  mysql -uignite -h %arg2% -p***** -e "CREATE DATABASE %arg3%"    pause

      If I place a value in arg3 - i.e. MYDatabaseName, then the script runs and fine from a web page that use the following coldfusion code to call the script:-

      <cfexecute name="fullpathtocmdfile\AddDatabase.cmd"  arguments="'MyDatabaseName'">  </cfexecute>

      But if I keep the %1 in there - ie the holder for the variable - then it doesn't seem to pick it up and create the database.

       

      Am I using the correct syntax to pass the variable into the file?

       

      Any help greatly appreciated

       

      Paul