|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Tuesday, December 22, 2009 5:16 AM
Points: 3,
Visits: 10
|
|
Hi, I am using SQLCMD in a batch file. I am unable to do the following thing I have to pass the address path in the following line.
sqlcmd -E -i "%1\File.sql" -o "%1\Log\File.txt"
Also please take care that the batch file should run by double clicking and so the path address from where it is called must be passed to the %1 menitoned in the SQLCMD code.
|
|
|
|
|
SSC-Addicted
      
Group: General Forum Members
Last Login: Wednesday, March 17, 2010 4:17 AM
Points: 473,
Visits: 836
|
|
passing parameters is not possible if you want to execute the batch file by double clicking it. Alternatevely, to get the current directory use the %CD% variable. This is how you can use it::
SET currentdirectory=%CD%
Now use %currentdirectory% instead of %1 in your code wherever you want the value of current directory.
-Vikas Bindra
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Tuesday, December 22, 2009 5:16 AM
Points: 3,
Visits: 10
|
|
Dear Vikas, Before reading your posting I tried with %~dp0 replacing %1/ and it worked fine. Today I will try with your stuff also Thanks for reply Vikas...
|
|
|
|
|
SSC-Addicted
      
Group: General Forum Members
Last Login: Wednesday, March 17, 2010 4:17 AM
Points: 473,
Visits: 836
|
|
Looks like %~dp0 is also an option to get the working directory. Thanks for updating me on this!!
The only difference I found is the leading '\' in case of %~dp0.
-Vikas Bindra
|
|
|
|