开发者

How do I know the default batch file directory?

I'm creating a batch file for SharePoint deployment. The batch will do solutions installation and configuration, create a web application and restore the .dat file on the created web application.

Instead of hard code the solutions path and .dat I want batch to know it is on the root. So, if I move this folder somewhere else I won't need to update the paths.

Is there any keyword of batch command which can tell where I stand (batch file directory)?

The batch script sample:

@SET STSADM="c:\program files\common files\microsoft shared\web server extensions\12\bin\stsadm"

Echo copy solution files ...
%STSADM% -o addsolution -filename SmilingGoat.SharePoint.WebParts.Rss.wsp
%STSADM% -o deploysolution -name SmilingGoat.SharePoint.WebParts.Rss.wsp -immediate -allowgacdeployment -allcontenturls

%STSADM% -o addsolution -开发者_开发知识库filename ReturnOfSmartPartv1_3.wsp
%STSADM% -o deploysolution -name ReturnOfSmartPartv1_3.wsp -immediate -allowgacdeployment -allcontenturls

Echo creating Learning Pitch application ... 
%STSADM% -o unextendvs -url http://server:70

%STSADM% -o restore -url http://server:70 -filename 2010.02.03.dat -overwrite

IISRESET

PAUSE

Thanks.


As far as I understand, %~p0 is what you are looking for.

For instance, if you create a file containing

echo %~p0
pause 

and run it from c:\temp it will output "c:\temp".

EDIT: Actually this answer in SO explains the idea.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜