Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Passing variables to command line script

New Here ,
Jan 08, 2013 Jan 08, 2013

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

TOPICS
Advanced techniques
548
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 13, 2013 Jan 13, 2013
LATEST

What is you used "CREATE DATABASE "%arg3% in place of "CREATE DATABASE %arg3%"?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources