PDA

View Full Version : need help passing params to DOS cmd


VBuild_Rookie
05-17-2004, 10:02 AM
I have a step that runs a dos cmd in it I have

%DOSCMD% "C:\My Projects\Sykes Newton\Enterprise\Version 1.0\ConfigManger\ConfigUpdate.exe" "/
configuration/appSettings/add[@key='DatasourceConnection']/@value" "initial catalog=PG_Newton;data source=SQL1;u
ser=USER1;Password=USERPWD1;Persist Security Info=False;" "C:\My Projects\Sykes Newton\Enterprise\Version 1.0\Set
up\Source\Server\Web\RemotingServices\Web.config"


I get this error
Building project step 'Remoting Services - Change the DB Name'...
Error expanding macros in property command: C:\WINDOWS\system32\cmd.exe /C "C:\My Projects\Sykes Newton\Enterprise\Version 1.0\ConfigManger\ConfigUpdate.exe" "/
configuration/appSettings/add<Error at Line 1, Column 5 (Syntax error)
Code: key='DatasourceConnection'>
Build ended.


but I can run the exact command in the dos window......any ideas ??

kinook
05-17-2004, 10:28 AM
Within step fields, you need to double up bracket chars to insert a literal bracket char (single brackets denote script code to be evaluated):

... [[@key='DatasourceConnection']] ...

Hold the Shift key down when mousing over a field to see the fully expanded value (with all macros expanded and script evaluated). See 'script expressions' in the help index for more details.

VBuild_Rookie
05-17-2004, 01:29 PM
thanks that got me furthere in the process I think ...now I get this error

'C:\My' is not recognized as an internal or external command,
operable program or batch file.


but i have double quotes around the "C:\My projects....."
not sure why is complaining

kinook
05-17-2004, 01:44 PM
Since you're not using anything that requires running under cmd.exe (redirection, an internal command, etc.) you can just drop the %DOSCMD% prefix from the command.

VBuild_Rookie
05-17-2004, 02:06 PM
still having issues I took out the %doscmd% and now I have just this

"C:\My Projects\Sykes Newton\Enterprise\Version 1.0\ConfigManger\ConfigUpdate.exe" "/configuration/appSettings/add[[@key='DatasourceConnection']]/@value" "initial catalog=PG_Newton;data source=PHMNL2SQL0033;user=PGNewton;Password=P6N3w0 u48 ?n;Persist Security Info=False;" "C:\My Projects\Sykes Newton\Enterprise\Version 1.0\Setup\Source\Server\Web\RemotingServices\Web.c onfig"

if I take this into cmd prompt and take away the extra "[" and "]" it runs fine.....not sure what I'm doing wrong in the first statement


any ideas ......thanks FOR ALL THE HELP SO FAR.....

kinook
05-17-2004, 02:14 PM
What issues are you having? Have you tried updating the config file within VBP via script instead as shown here: http://www.kinook.com/Forum/showthread.php?threadid=427

VBuild_Rookie
05-17-2004, 02:35 PM
I have not tried the script method just yet.....I have created a exe (Configupdate.exe) that takes a xpath to change.....it works within the command prompt......but once I place it in visual build I get this error


The filename, directory name, or volume label syntax is incorrect.

Build successfully completed.

kinook
05-17-2004, 03:07 PM
Not sure. Run Program does essentially the same thing that cmd.exe to run a command (call CreateProcess). It sounds like the error is coming from your exe. Try copying your exe to the root of the drive and invoke it without any parameters (i.e., use a Run Program command of C:\ConfigUpdate.exe), then add your parameters one at a time to determine what it's complaining about.