Destination IUnknown

Mostly on .NET, Java, Blogosphere, software development and techie stuff by Victor Hadianto

Tuesday, 3 March 2009

Running DOS batch file from UNC path

My DOS batch install file broke when I tried running them from a UNC path. It says: "CMD does not support UNC paths as current directories". Old error message but new to me. Make sense since DOS was around before the UNC path era.

Turn out that there is a solution, not the cleanest but it works. Basically you have to do this:


pushd "%~dp0"

REM ... do your stuff

popd


What pushd does is automatically map the given parameter as a drive and popd removes the mapping. Not the best solution, but a working one. And the "%~dp0" parameter gets you the current directory of the batch file.

Labels:

Wednesday, 5 March 2008

LoaderLock was detected

Blimey … what was that? This kind of exception, that only happens during debugging, confuses developers. Googling about the problem shows that Microsoft at times gives pointless answer. Some blame iTunes about this problem ;)

Rather than following the advice to turn this rather useful check in VS 2005, the most probable causes of this problem are:

1) An unmanaged dll calls a managed dll on its DLLMain or
2) Not marshalling your call back to the main UI thread.

Vivek wrote a bit more about this problem here.

Labels: ,