January 14, 2009 at 2:01 am
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.
January 14, 2009 at 2:23 am
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
January 14, 2009 at 9:03 pm
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...
January 15, 2009 at 12:06 am
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
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy