PDA

View Full Version : Command Line Args


Sheritlw
03-28-2007, 08:45 PM
I have created a setup that downloads, unpacks and installs sql server express from the command line in Setup Factory. That works great.
My problem is after I install sql server I need to run a custom console program using command lines and this does not work. The dos screen pops up but it doesn't do anything except close (it's suppose to create a user, database etc.).

I tried running the program through Windows command line and it works.
The code I use is below. I also tried running another console program from the File.run in sf7 and have the same problem.

result = File.Run(_TempFolder.."\\ScriptRunner.exe", "server:.\EZEXPRESS script:".._TempFolder.."\\create_user.sql", "", SW_SHOWNORMAL, true);
--create db

result = File.Run(_TempFolder.."\\ScriptRunner.exe", "server:.\EZEXPRESS uid:ezuser pwd:p@ssw0rd db:ScheduleEz script:".._TempFolder.."\\create_db.sql", "", SW_SHOWNORMAL, true);
--import data

result = File.Run(_TempFolder.."\\ScriptRunner.exe", "server:.\EZEXPRESS uid:ezuser pwd:p@ssw0rd db:ScheduleEz script:".._TempFolder.."\\new_data.sql", "", SW_SHOWNORMAL, true);

pww
03-29-2007, 02:56 AM
If the cmd window quickly disappears there is likely an error in the command (like \ instead of \\, missing quotes etc.), but you can't see the err message because it closes very fast.
Create your command as a string and then display it in a message box. When the message box pops, open a cmd window and retype the text from the message box there, then press Enter. This way the cmd window will not auto close and you can see if an error is displayed.
Another way is to save the command string as a .bat file, open a cmd window and run it.

Sheritlw
03-29-2007, 02:05 PM
I tried using the \\ in the following (.\\EZEXPRESS) server:.\EZEXPRESS but that didn't work. Has anyone else had problems running a console app.

The following is what I use to install sql express from command and it works great.

ReturnCode = File.Run(_TempFolder.."\\SQLEXPR32", "SQLEXPR /X:".._TempFolder, "", SW_HIDE, true);

result = File.Run(_TempFolder.."\\setup.exe", "start /wait setup.exe /qb /settings".._TempFolder.."\\SQLXNew.ini", "", SW_SHOWNORMAL, true);


The only thing different is really the type of exe it is running.

Sheritlw
03-30-2007, 02:28 AM
The problem was my fault; I had two copies of my script.exe and was using the older one. It works fine.

I must say, I have been using your products for years and your company still gives the best support.

Thanks,

Sheri