February 1, 2005 at 8:31 am
Probably a dumb question but how should I input a line like the following. CMD obviously does not like the spaces in the directory path.
sqlservr.exe -sbusinesstesting -c -dC:\Program Files\Microsoft SQL Server\MSSQL\Data\master.mdf -lC:\Program Files\Microsoft SQL Server\MSSQL\Data\mastlog.ldf -m -eC:\Program Files\Microsoft SQL Server\MSSQL\LOG\ERRORLOG
In the past a much simpler command line worked to start a named instance in single-user mode but for reasons I don't understand seems to be going for the default instance error log so I decided to try the syntax above.
February 1, 2005 at 8:39 am
The easiest method is to go back to the 8.3 dos format for the path. A quick way to find out is from a cmd prompt
cd "C:\Program Files\Microsoft SQL Server\MSSQL\Data\" type edit After Edit comes up Type Alt Key -> F -> X to exit out of the editor. Your prompt should now be something like C:\PROGRA~1\MICROS~4\MSSQL\Data
That will be your 8.3 dos path. Substitute that in and you should work.
----------------
Jim P.
A little bit of this and a little byte of that can cause bloatware.
February 1, 2005 at 9:05 am
Jim P, many thanks for your help. I thought I was missing something when surfing for the command line syntax. No wonder that Microsoft doesn't attempt to explain.
I was really expecting the solution to be obvious and to hide my head in shame.
Thanks again
February 1, 2005 at 9:51 am
DOS command dir with the /X switch gives the short names too.
DIR /X
Do not hardcode short names. They can change if you add/delete folders and also if you backup/reastore in case you have more then one directory that starts the same:
Program Files Progra~1
Programs
Regards,Yelena Varsha
February 1, 2005 at 11:03 am
The DIR /X only gives you the short name of the files/directories in that directory. My method automatically translates the whole prompt for you.
I agree the preference is not to hardcode the short names, but I've played with trying to use quotes in cmd prompts and have horrible failures and only one or two successes. Hopefully he isn't having to delete/restore these folders on a constant basis.
----------------
Jim P.
A little bit of this and a little byte of that can cause bloatware.
February 1, 2005 at 3:51 pm
Jim,
I agree. What you use, edit-exit or Dir /x depends on what you need, the path or several short names from the same directory.
Do you know batch programming well? Did you try variables? Maybe we have to use pre-defined variables to avoid long name problems?
I just tried the following, it worked. I ran a script from the folder C:\Folder1\Folder2\Folder3 after creating a new user environmental variable SQL_Folder with the value C:\Program Files\Microsoft SQL Server and putting a file Test.txt in the actual directory
cd ..
cd ..
cd ..
copy "%SQL_Folder%\Test.txt" "%SQL_Folder%\Test2.txt"
CD %SQL_Folder%
dir
PAUSE
It returned that 1 file copied and the listing of Microsoft SQL Server folder. For some reason I was not able to use variables that I create in the script like SET MyVar = "C:\Program Files" I have a copy of another batch file that uses those dynamic variables just fine, but not in this case.
Regards,Yelena Varsha
February 1, 2005 at 4:04 pm
This is not a regular thing. Only when I have a major release and want to replicate the production environment exactly.
You have both been very helpful, thanks.
February 2, 2005 at 5:05 am
Most command line executables will work with spaces in parameters if you wrap the argument in double quotes:
-F"c:\program files\microsoft sql server\..."
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply