开发过程中编写的一些批处理

1.BuildRelease.bat

用于不开启VS直接编译、部署、创建和恢复快照 WindowsPhone APP,注册WindowsPhone手机。

进行了编译和部署的效果:

BuildRelease.bat

  1 @echo off
  2 pushd "%~dp0"
  3 title Build Release
  4 set folder=%CD%
  5 set MSBUILD=%windir%\microsoft.net\framework\v4.0.30319\msbuild.exe
  6 set APPDEPLOYCMD="%ProgramFiles(x86)%\Microsoft SDKs\Windows Phone\v8.1\Tools\AppDeploy\AppDeployCmd.exe"
  7 set APPDEPLOY="%ProgramFiles(x86)%\Microsoft SDKs\Windows Phone\v8.1\Tools\AppDeploy\AppDeploy.exe"
  8 set ISETOOL="%ProgramFiles(x86)%\Microsoft SDKs\Windows Phone\v8.1\Tools\IsolatedStorageExplorerTool\isetool.exe"
  9 set PHONEREG="%ProgramFiles(x86)%\Microsoft SDKs\Windows Phone\v8.1\Tools\Phone Registration\PhoneReg.exe"
 10 set PRODUCTID=6d24eb8a-60e9-4d9c-a943-f6d5c7796649
 11 set DESKTOPPATH=myfiles
 12 set XAPFILE="%folder%\Youku.Bin\Release\Youku_Release_ARM.xap"
 13 set msbuildlog="%folder%\lastmsbuild.log"
 14 set filelogger=/fl /flp:logfile=%msbuildlog%
 15 if "%folder%"=="" goto :edit
 16 if NOT EXIST %folder% goto :edit
 17 :menu
 18 echo.
 19 echo Target: %folder%
 20 echo ^<Menu^>
 21 echo 1.Build    2.Rebuild    3[3].Deploy and Run    4.Update    5.Uninstall
 22 echo 6.Dir IsolatedStore     7.Take snapshot        8.Restore snapshot
 23 echo 9.Phone Reg Tool        L.Open last msbuild log file       x.Exit
 24 set input=
 25 set /p input=Command:
 26 if "%input%"=="1" goto :build
 27 if "%input%"=="2" goto :rebuild
 28 if "%input%"=="3" goto :deploy
 29 if "%input%"=="4" goto :update
 30 if "%input%"=="5" goto :uninstall
 31 if "%input%"=="6" goto :isedir
 32 if "%input%"=="7" goto :isets
 33 if "%input%"=="8" goto :isers
 34 if "%input%"=="9" goto :phonereg
 35 if "%input%"=="l" goto :openlogfile
 36 if "%input%"=="L" goto :openlogfile
 37 if "%input%"=="x" goto :end
 38 if "%input%"=="X" goto :end
 39 if "%input%"=="exit" goto :end
 40 if "%input%"=="33" goto :startAPPDEPLOY
 41 goto :menu
 42 :build
 43 echo Boot Building...
 44 echo ^(1/5^) Building UPlayer_WRT.vcxproj ...
 45 %MSBUILD% /t:Build /p:Configuration=Release;Platform=ARM /nologo /noconsolelogger %filelogger% "%folder%\UPlayer\UPlayer_WRT\UPlayer_WRT.vcxproj"
 46 if %ERRORLEVEL% NEQ 0 (echo ^>^> BUILD UPlayer_WRT.vcxproj ERROR! ^(%ERRORLEVEL%^)&&goto :menu)
 47 echo ^(2/5^) Building UPlayer_players.csproj ...
 48 %MSBUILD% /t:Build /p:Configuration=Release;Platform=ARM /nologo /noconsolelogger %filelogger% "%folder%\UPlayer\UPlayer_players\UPlayer_players.csproj"
 49 if %ERRORLEVEL% NEQ 0 (echo ^>^> BUILD UPlayer_players.csproj ERROR! ^(%ERRORLEVEL%^)&&goto :menu)
 50 echo ^(3/5^) Building Youku.Pattern.csproj ...
 51 %MSBUILD% /t:Build /p:Configuration=Release;Platform=ARM /nologo /noconsolelogger %filelogger% "%folder%\Youku.Pattern\Youku.Pattern.csproj"
 52 if %ERRORLEVEL% NEQ 0 (echo ^>^> BUILD Youku.Pattern.csproj ERROR! ^(%ERRORLEVEL%^)&&goto :menu)
 53 echo ^(4/5^) Building Youku.Online.csproj ...
 54 %MSBUILD% /t:Build /p:Configuration=Release;Platform=ARM /nologo /noconsolelogger %filelogger% "%folder%\Youku.Online\Youku.Online.csproj"
 55 if %ERRORLEVEL% NEQ 0 (echo ^>^> BUILD Youku.Online.csproj ERROR! ^(%ERRORLEVEL%^)&&goto :menu)
 56 echo ^(5/5^) Building Youku.csproj ...
 57 %MSBUILD% /t:Build /p:Configuration=Release;Platform=ARM /nologo /noconsolelogger %filelogger% "%folder%\Youku\Youku.csproj"
 58 if %ERRORLEVEL% NEQ 0 (echo ^>^> BUILD Youku.csproj ERROR! ^(%ERRORLEVEL%^)) else (echo ALL BUILD OK.)
 59 goto :menu
 60 :rebuild
 61 set /p MYCONSOLE=Rebuild with MYCONSOLE?(Y/N):
 62 set DefineConstants=
 63 if "%MYCONSOLE%"=="y" set DefineConstants=DefineConstants^=^"MYCONSOLE^";
 64 if "%MYCONSOLE%"=="Y" set DefineConstants=DefineConstants^=^"MYCONSOLE^";
 65 echo Boot Rebuilding...
 66 echo ^(1/5^) Rebuilding UPlayer_WRT.vcxproj ...
 67 %MSBUILD% /t:Rebuild /p:Configuration=Release;Platform=ARM /nologo /noconsolelogger %filelogger% "%folder%\UPlayer\UPlayer_WRT\UPlayer_WRT.vcxproj"
 68 if %ERRORLEVEL% NEQ 0 (echo ^>^> REBUILD UPlayer_WRT.vcxproj ERROR! ^(%ERRORLEVEL%^)&&goto :menu)
 69 echo ^(2/5^) Rebuilding UPlayer_players.csproj ...
 70 %MSBUILD% /t:Rebuild /p:Configuration=Release;Platform=ARM /nologo /noconsolelogger %filelogger% "%folder%\UPlayer\UPlayer_players\UPlayer_players.csproj"
 71 if %ERRORLEVEL% NEQ 0 (echo ^>^> REBUILD UPlayer_players.csproj ERROR! ^(%ERRORLEVEL%^)&&goto :menu)
 72 echo ^(3/5^) Rebuilding Youku.Pattern.csproj ...
 73 %MSBUILD% /t:Rebuild /p:Configuration=Release;Platform=ARM /nologo /noconsolelogger %filelogger% "%folder%\Youku.Pattern\Youku.Pattern.csproj"
 74 if %ERRORLEVEL% NEQ 0 (echo ^>^> REBUILD Youku.Pattern.csproj ERROR! ^(%ERRORLEVEL%^)&&goto :menu)
 75 echo ^(4/5^) Rebuilding Youku.Online.csproj ...
 76 %MSBUILD% /t:Rebuild /p:Configuration=Release;Platform=ARM /nologo /noconsolelogger %filelogger% "%folder%\Youku.Online\Youku.Online.csproj"
 77 if %ERRORLEVEL% NEQ 0 (echo ^>^> REBUILD Youku.Online.csproj ERROR! ^(%ERRORLEVEL%^)&&goto :menu)
 78 echo ^(5/5^) Rebuilding Youku.csproj ...
 79 %MSBUILD% /t:Rebuild /p:%DefineConstants%Configuration=Release;Platform=ARM /nologo /noconsolelogger %filelogger% "%folder%\Youku\Youku.csproj"
 80 if %ERRORLEVEL% NEQ 0 (echo ^>^> REBUILD Youku.csproj ERROR! ^(%ERRORLEVEL%^)) else (echo ALL REBUILD OK.)
 81 goto :menu
 82 :deploy
 83 echo Deploying. Please wait.................
 84 if NOT EXIST %APPDEPLOYCMD% goto noAPPDEPLOYCMD
 85 %APPDEPLOYCMD% /installlaunch %XAPFILE% /targetdevice:de
 86 if %ERRORLEVEL% EQU 5 goto :startAPPDEPLOY
 87 if %ERRORLEVEL% NEQ 0 (echo ^>^> DEPLOY ERROR! ^(%ERRORLEVEL%^)) else (echo DEPLOY OK.)
 88 goto :menu
 89 :noAPPDEPLOYCMD
 90 echo Warnning: AppDeployCmd.exe is not found!
 91 :startAPPDEPLOY
 92 echo Start AppDeploy.exe ...
 93 start "" /d "%folder%\Youku.Bin\Release" %APPDEPLOY%
 94 ping -n 2 127.1>nul
 95 goto :menu
 96 :update
 97 echo Updating. Please wait.................
 98 if NOT EXIST %APPDEPLOYCMD% goto noAPPDEPLOYCMD
 99 %APPDEPLOYCMD% /update %XAPFILE% /targetdevice:de
100 if %ERRORLEVEL% EQU 5 goto :startAPPDEPLOY
101 if %ERRORLEVEL% NEQ 0 (echo ^>^> UPDATE ERROR! ^(%ERRORLEVEL%^)) else (echo UPDATE OK.)
102 goto :menu
103 :uninstall
104 echo Uninstall. Please wait.................
105 if NOT EXIST %APPDEPLOYCMD% (echo Warnning: AppDeployCmd.exe is not found!&&goto :menu)
106 echo   ^* Product ID: %PRODUCTID%
107 %APPDEPLOYCMD% /uninstall %PRODUCTID% /targetdevice:de
108 if %ERRORLEVEL% NEQ 0 (echo ^>^> Uninstall ERROR! ^(%ERRORLEVEL%^)) else (echo Uninstall OK.)
109 goto :menu
110 :isedir
111 echo Dir IsolatedStore. Please wait.................
112 echo   ^* Product ID: %PRODUCTID%
113 %ISETOOL% dir de %PRODUCTID%
114 ::if %ERRORLEVEL% NEQ 0 (echo ^>^> Dir isolated storage ERROR!) else (echo Dir isolated storage OK.)
115 goto :menu
116 :isets
117 echo Take snapshot. Please wait.................
118 echo   ^* Product ID: %PRODUCTID%
119 echo   ^* Desktop Path: %DESKTOPPATH%
120 %ISETOOL% ts de %PRODUCTID% "%folder%\%DESKTOPPATH%"
121 ::if %ERRORLEVEL% NEQ 0 (echo ^>^> Take snapshot ERROR!) else (echo Take snapshot OK.)
122 goto :menu
123 :isers
124 echo Restore snapshot. Please wait.................
125 echo   ^* Product ID: %PRODUCTID%
126 echo   ^* Desktop Path: %DESKTOPPATH%\IsolatedStore
127 %ISETOOL% rs de %PRODUCTID% "%folder%\%DESKTOPPATH%\IsolatedStore"
128 ::if %ERRORLEVEL% NEQ 0 (echo ^>^> Restore snapshot ERROR!) else (echo Restore snapshot OK.)
129 goto :menu
130 :phonereg
131 echo Start PhoneReg.exe ...
132 start "" %PHONEREG%
133 ping -n 2 127.1>nul
134 goto :menu
135 :openlogfile
136 if exist %msbuildlog% (start "" notepad %msbuildlog%) else (echo Logfile not found.) 
137 goto :menu
138 :edit
139 start "" notepad "%0"
140 :end
141 popd
142 exit

 

BuildRelease_8.0.bat (WindowsPhone 8.0版本)

  1 @echo off
  2 pushd "%~dp0"
  3 title Build Release for WP8.0
  4 set folder=%CD%
  5 set MSBUILD=%windir%\microsoft.net\framework\v4.0.30319\msbuild.exe
  6 set XAPDEPLOYCMD="%ProgramFiles(x86)%\Microsoft SDKs\Windows Phone\v8.0\Tools\XAP Deployment\XapDeployCmd.exe"
  7 set XAPDEPLOY="%ProgramFiles(x86)%\Microsoft SDKs\Windows Phone\v8.0\Tools\XAP Deployment\XapDeploy.exe"
  8 set ISETOOL="%ProgramFiles(x86)%\Microsoft SDKs\Windows Phone\v8.0\Tools\IsolatedStorageExplorerTool\isetool.exe"
  9 set PHONEREG="%ProgramFiles(x86)%\Microsoft SDKs\Windows Phone\v8.0\Tools\Phone Registration\PhoneReg.exe"
 10 set PRODUCTID=6d24eb8a-60e9-4d9c-a943-f6d5c7796649
 11 set DESKTOPPATH=myfiles
 12 set XAPFILE="%folder%\Youku.Bin\Release\Youku_Release_ARM.xap"
 13 set msbuildlog="%folder%\lastmsbuild.log"
 14 set filelogger=/fl /flp:logfile=%msbuildlog%
 15 if "%folder%"=="" goto :edit
 16 if NOT EXIST %folder% goto :edit
 17 :menu
 18 echo.
 19 echo Target: %folder%
 20 echo ^<Menu^>
 21 echo 1.Build    2.Rebuild    3[3].Deploy and Run    4.Update    5.Uninstall
 22 echo 6.Dir IsolatedStore     7.Take snapshot        8.Restore snapshot
 23 echo 9.Phone Reg Tool        L.Open last msbuild log file       x.Exit
 24 set input=
 25 set /p input=Command:
 26 if "%input%"=="1" goto :build
 27 if "%input%"=="2" goto :rebuild
 28 if "%input%"=="3" goto :deploy
 29 if "%input%"=="4" goto :update
 30 if "%input%"=="5" goto :uninstall
 31 if "%input%"=="6" goto :isedir
 32 if "%input%"=="7" goto :isets
 33 if "%input%"=="8" goto :isers
 34 if "%input%"=="9" goto :phonereg
 35 if "%input%"=="l" goto :openlogfile
 36 if "%input%"=="L" goto :openlogfile
 37 if "%input%"=="x" goto :end
 38 if "%input%"=="X" goto :end
 39 if "%input%"=="exit" goto :end
 40 if "%input%"=="33" goto :startXAPDEPLOY
 41 goto :menu
 42 :build
 43 echo Boot Building...
 44 echo ^(1/5^) Building UPlayer_WRT.vcxproj ...
 45 %MSBUILD% /t:Build /p:Configuration=Release;Platform=ARM /nologo /noconsolelogger %filelogger% "%folder%\UPlayer\UPlayer_WRT\UPlayer_WRT.vcxproj"
 46 if %ERRORLEVEL% NEQ 0 (echo ^>^> BUILD UPlayer_WRT.vcxproj ERROR! ^(%ERRORLEVEL%^)&&goto :menu)
 47 echo ^(2/5^) Building UPlayer_players.csproj ...
 48 %MSBUILD% /t:Build /p:Configuration=Release;Platform=ARM /nologo /noconsolelogger %filelogger% "%folder%\UPlayer\UPlayer_players\UPlayer_players.csproj"
 49 if %ERRORLEVEL% NEQ 0 (echo ^>^> BUILD UPlayer_players.csproj ERROR! ^(%ERRORLEVEL%^)&&goto :menu)
 50 echo ^(3/5^) Building Youku.Pattern.csproj ...
 51 %MSBUILD% /t:Build /p:Configuration=Release;Platform=ARM /nologo /noconsolelogger %filelogger% "%folder%\Youku.Pattern\Youku.Pattern.csproj"
 52 if %ERRORLEVEL% NEQ 0 (echo ^>^> BUILD Youku.Pattern.csproj ERROR! ^(%ERRORLEVEL%^)&&goto :menu)
 53 echo ^(4/5^) Building Youku.Online.csproj ...
 54 %MSBUILD% /t:Build /p:Configuration=Release;Platform=ARM /nologo /noconsolelogger %filelogger% "%folder%\Youku.Online\Youku.Online.csproj"
 55 if %ERRORLEVEL% NEQ 0 (echo ^>^> BUILD Youku.Online.csproj ERROR! ^(%ERRORLEVEL%^)&&goto :menu)
 56 echo ^(5/5^) Building Youku.csproj ...
 57 %MSBUILD% /t:Build /p:Configuration=Release;Platform=ARM /nologo /noconsolelogger %filelogger% "%folder%\Youku\Youku.csproj"
 58 if %ERRORLEVEL% NEQ 0 (echo ^>^> BUILD Youku.csproj ERROR! ^(%ERRORLEVEL%^)) else (echo ALL BUILD OK.)
 59 goto :menu
 60 :rebuild
 61 set /p MYCONSOLE=Rebuild with MYCONSOLE?(Y/N):
 62 set DefineConstants=
 63 if "%MYCONSOLE%"=="y" set DefineConstants=DefineConstants^=^"MYCONSOLE^";
 64 if "%MYCONSOLE%"=="Y" set DefineConstants=DefineConstants^=^"MYCONSOLE^";
 65 echo Boot Rebuilding...
 66 echo ^(1/5^) Rebuilding UPlayer_WRT.vcxproj ...
 67 %MSBUILD% /t:Rebuild /p:Configuration=Release;Platform=ARM /nologo /noconsolelogger %filelogger% "%folder%\UPlayer\UPlayer_WRT\UPlayer_WRT.vcxproj"
 68 if %ERRORLEVEL% NEQ 0 (echo ^>^> REBUILD UPlayer_WRT.vcxproj ERROR! ^(%ERRORLEVEL%^)&&goto :menu)
 69 echo ^(2/5^) Rebuilding UPlayer_players.csproj ...
 70 %MSBUILD% /t:Rebuild /p:Configuration=Release;Platform=ARM /nologo /noconsolelogger %filelogger% "%folder%\UPlayer\UPlayer_players\UPlayer_players.csproj"
 71 if %ERRORLEVEL% NEQ 0 (echo ^>^> REBUILD UPlayer_players.csproj ERROR! ^(%ERRORLEVEL%^)&&goto :menu)
 72 echo ^(3/5^) Rebuilding Youku.Pattern.csproj ...
 73 %MSBUILD% /t:Rebuild /p:Configuration=Release;Platform=ARM /nologo /noconsolelogger %filelogger% "%folder%\Youku.Pattern\Youku.Pattern.csproj"
 74 if %ERRORLEVEL% NEQ 0 (echo ^>^> REBUILD Youku.Pattern.csproj ERROR! ^(%ERRORLEVEL%^)&&goto :menu)
 75 echo ^(4/5^) Rebuilding Youku.Online.csproj ...
 76 %MSBUILD% /t:Rebuild /p:Configuration=Release;Platform=ARM /nologo /noconsolelogger %filelogger% "%folder%\Youku.Online\Youku.Online.csproj"
 77 if %ERRORLEVEL% NEQ 0 (echo ^>^> REBUILD Youku.Online.csproj ERROR! ^(%ERRORLEVEL%^)&&goto :menu)
 78 echo ^(5/5^) Rebuilding Youku.csproj ...
 79 %MSBUILD% /t:Rebuild /p:%DefineConstants%Configuration=Release;Platform=ARM /nologo /noconsolelogger %filelogger% "%folder%\Youku\Youku.csproj"
 80 if %ERRORLEVEL% NEQ 0 (echo ^>^> REBUILD Youku.csproj ERROR! ^(%ERRORLEVEL%^)) else (echo ALL REBUILD OK.)
 81 goto :menu
 82 :deploy
 83 echo Deploying. Please wait.................
 84 if NOT EXIST %XAPDEPLOYCMD% goto noXAPDEPLOYCMD
 85 %XAPDEPLOYCMD% /installlaunch %XAPFILE% /targetdevice:de
 86 if %ERRORLEVEL% EQU 5 goto :startXAPDEPLOY
 87 if %ERRORLEVEL% NEQ 0 (echo ^>^> DEPLOY ERROR! ^(%ERRORLEVEL%^)) else (echo DEPLOY OK.)
 88 goto :menu
 89 :noXAPDEPLOYCMD
 90 echo Warnning: XapDeployCmd.exe is not found!
 91 :startXAPDEPLOY
 92 echo Start XapDeploy.exe ...
 93 start "" /d "%folder%\Youku.Bin\Release" %XAPDEPLOY%
 94 ping -n 2 127.1>nul
 95 goto :menu
 96 :update
 97 echo Updating. Please wait.................
 98 if NOT EXIST %XAPDEPLOYCMD% goto noXAPDEPLOYCMD
 99 %XAPDEPLOYCMD% /update %XAPFILE% /targetdevice:de
100 if %ERRORLEVEL% EQU 5 goto :startXAPDEPLOY
101 if %ERRORLEVEL% NEQ 0 (echo ^>^> UPDATE ERROR! ^(%ERRORLEVEL%^)) else (echo UPDATE OK.)
102 goto :menu
103 :uninstall
104 echo Uninstall. Please wait.................
105 if NOT EXIST %XAPDEPLOYCMD% (echo Warnning: XapDeployCmd.exe is not found!&&goto :menu)
106 echo   ^* Product ID: %PRODUCTID%
107 %XAPDEPLOYCMD% /uninstall %PRODUCTID% /targetdevice:de
108 if %ERRORLEVEL% NEQ 0 (echo ^>^> Uninstall ERROR! ^(%ERRORLEVEL%^)) else (echo Uninstall OK.)
109 goto :menu
110 :isedir
111 echo Dir IsolatedStore. Please wait.................
112 echo   ^* Product ID: %PRODUCTID%
113 %ISETOOL% dir de %PRODUCTID%
114 ::if %ERRORLEVEL% NEQ 0 (echo ^>^> Dir isolated storage ERROR!) else (echo Dir isolated storage OK.)
115 goto :menu
116 :isets
117 echo Take snapshot. Please wait.................
118 echo   ^* Product ID: %PRODUCTID%
119 echo   ^* Desktop Path: %DESKTOPPATH%
120 %ISETOOL% ts de %PRODUCTID% "%folder%\%DESKTOPPATH%"
121 ::if %ERRORLEVEL% NEQ 0 (echo ^>^> Take snapshot ERROR!) else (echo Take snapshot OK.)
122 goto :menu
123 :isers
124 echo Restore snapshot. Please wait.................
125 echo   ^* Product ID: %PRODUCTID%
126 echo   ^* Desktop Path: %DESKTOPPATH%\IsolatedStore
127 %ISETOOL% rs de %PRODUCTID% "%folder%\%DESKTOPPATH%\IsolatedStore"
128 ::if %ERRORLEVEL% NEQ 0 (echo ^>^> Restore snapshot ERROR!) else (echo Restore snapshot OK.)
129 goto :menu
130 :phonereg
131 echo Start PhoneReg.exe ...
132 start "" %PHONEREG%
133 ping -n 2 127.1>nul
134 goto :menu
135 :openlogfile
136 if exist %msbuildlog% (start "" notepad %msbuildlog%) else (echo Logfile not found.) 
137 goto :menu
138 :edit
139 start "" notepad "%0"
140 :end
141 popd
142 exit
View Code

 

2.拷贝项目副本.bat

用于创建项目副本。比如开发新版本时,用ROBOCOPY在本地复制一份出来。

效果如图:

  

 

拷贝项目副本.bat

 1 @echo off
 2 echo ---------------------------------
 3 echo ROBOCOPY source-dir dest-dir /MIR
 4 echo ---------------------------------
 5 title ROBOCOPY source-dir dest-dir
 6 :setsource
 7 set /p source=source-dir:
 8 if "%source%"=="" goto :setsource
 9 if not exist %source% echo The source-dir doesn't exist. Please input again.&&goto :setsource
10 title ROBOCOPY %source% dest-dir
11 :setdestination
12 set /p destination=dest-dir:
13 if "%destination%"=="" goto :setdestination
14 if not exist %destination% goto :startrobocopy
15 :overwritequestion
16 set /p key=The dest-dir has existed. Do it?(Y/N):
17 if "%key%"=="" goto :overwritequestion
18 if "%key%"=="Y" goto :startrobocopy
19 if "%key%"=="y" goto :startrobocopy
20 goto :setdestination
21 :startrobocopy
22 title ROBOCOPY %source% %destination%
23 set XF=Thumbs.db
24 set XD=.svn myfiles
25 robocopy %source% %destination% /MIR /XF %XF% /XD %XD%
26 title ROBOCOPY %source% %destination% (Completed)
27 set /p key=Press ENTER to open folder...
28 explorer /select,"%destination%\BuildRelease.bat"

 

创建项目NOKIA包.bat

其中包含了文件名大写、Unicode代码替换功能,替换图像等文件按项目文件结构放在 wp8nokiaupdate 文件夹中。

 1 @echo off
 2 echo ---------------------------
 3 echo Create Project-Nokia
 4 echo ---------------------------
 5 title Create Project-Nokia
 6 color 17
 7 :setsource
 8 set /p source=source-dir:
 9 if "%source%"=="" goto :setsource
10 if not exist %source% echo The source-dir doesn't exist. Please input again.&&goto :setsource
11 :setdestination
12 set "destination=%source:wp8_v=诺基亚wp8_v%"
13 for %%i in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) do call set destination=%%destination:%%i=%%i%%
14 if "%destination%"=="" goto :setdestination
15 if not exist %destination% goto :startrobocopy
16 :overwritequestion
17 set /p key=The dest-dir has existed. Do it?(Y/N):
18 if "%key%"=="" goto :overwritequestion
19 if "%key%"=="Y" goto :startrobocopy
20 if "%key%"=="y" goto :startrobocopy
21 goto :setsource
22 :startrobocopy
23 color 2e
24 set XF=Thumbs.db
25 set XD=.svn myfiles
26 robocopy %source% %destination% /MIR /XF %XF% /XD %XD%
27 if not exist wp8nokiaupdate goto :editAppid
28 echo ^>^> Xcopying wp8nokiaupdate files...
29 xcopy wp8nokiaupdate %destination%\ /s /e /g /h /r /k /y
30 :editAppid
31 rem echo ^>^> Replace AppId, MarketPlaceAppId, IdleDetectionMode, Agree for Terms and Privacy...
32 echo ^>^> Replace AppId, MarketPlaceAppId...
33 set sourceappid=ad00404c17cb662e
34 set nokiaappid=515158cd5f9b803b
35 set sourcemarketplaceappid=cdfb7d0f-825e-40b4-b146-3853a0646994
36 set nokiamarketplaceappid=923aa42b-882c-4815-9c69-b74100cac3c9
37 set replacefile1=%destination%\Youku.Online\YoukuService\YoukuServicePartOne.cs
38 rem set replacefile2=%destination%\Youku\App.xaml.cs
39 rem set replacefile3=%destination%\Youku\Views\UserRegisterPageView.xaml
40 set tempvbs=%~n0_replace_appid.vbs
41 echo function ansi2utf8(strFile,s1,s2,newname) >%tempvbs%
42 echo Set ADOStrm = CreateObject("ADODB.Stream") >>%tempvbs%
43 echo ADOStrm.Type = 2 >>%tempvbs%
44 echo ADOStrm.Mode = 3 >>%tempvbs%
45 echo ADOStrm.CharSet = s1 >>%tempvbs%
46 echo ADOStrm.Open >>%tempvbs%
47 echo ADOStrm.LoadFromFile strFile >>%tempvbs%
48 echo s = ADOStrm.ReadText >>%tempvbs%
49 echo ADOStrm.Position = 0 >>%tempvbs%
50 echo ADOStrm.CharSet = s2 >>%tempvbs%
51 echo ADOStrm.WriteText s >>%tempvbs%
52 echo ADOStrm.SetEOS >>%tempvbs%
53 echo ADOStrm.SaveToFile newname, 2 >>%tempvbs%
54 echo ADOStrm.Close >>%tempvbs%
55 echo end function >>%tempvbs%
56 echo function strReplace(pFile,pStr,reStr) >>%tempvbs%
57 echo set fso=CreateObject("Scripting.FileSystemObject") >>%tempvbs%
58 echo set ws=CreateObject("wscript.shell") >>%tempvbs%
59 echo filename=pFile >>%tempvbs%
60 echo ansi2utf8 filename,"utf-8","gbk","temp.tmp" >>%tempvbs%
61 echo set fr=fso.opentextfile("temp.tmp",1,-1) >>%tempvbs%
62 echo set fw=fso.createtextfile("temp2.tmp",2) >>%tempvbs%
63 echo Set regEx = New RegExp >>%tempvbs%
64 echo do >>%tempvbs%
65 echo data=fr.readline >>%tempvbs%
66 echo regEx.Pattern = pStr >>%tempvbs%
67 echo data = regEx.Replace(data, reStr) >>%tempvbs%
68 echo fw.writeline data >>%tempvbs%
69 echo loop until fr.atendofstream >>%tempvbs%
70 echo fw.close:fr.close >>%tempvbs%
71 echo ansi2utf8 "temp2.tmp","gbk","utf-8",filename >>%tempvbs%
72 echo fso.deletefile "temp.tmp",true >>%tempvbs%
73 echo fso.deletefile "temp2.tmp",true >>%tempvbs%
74 echo end function >>%tempvbs%
75 echo strReplace "%replacefile1%","""%sourceappid%""","""%nokiaappid%""" >>%tempvbs%
76 echo strReplace "%replacefile1%","""%sourcemarketplaceappid%""","""%nokiamarketplaceappid%""" >>%tempvbs%
77 rem echo strReplace "%replacefile2%","PhoneApplicationService.Current.UserIdleDetectionMode","//PhoneApplicationService.Current.UserIdleDetectionMode" >>%tempvbs%
78 rem echo strReplace "%replacefile2%","PhoneApplicationService.Current.ApplicationIdleDetectionMode","//PhoneApplicationService.Current.ApplicationIdleDetectionMode" >>%tempvbs%
79 rem echo strReplace "%replacefile3%","Name=""acceptConventionCheckBox""  IsChecked=""True""","Name=""acceptConventionCheckBox""  IsChecked=""False""" >>%tempvbs%
80 wscript %tempvbs%
81 ping 127.1 -n 2 >nul
82 del %tempvbs% /q>nul
83 find /n /i "%nokiaappid%" %replacefile1%
84 find /n /i "%nokiamarketplaceappid%" %replacefile1%
85 if %ERRORLEVEL% NEQ 0 (echo ^>^> Replace AppId ERROR!) else (echo Replace AppId OK.)
86 :completed
87 echo Completed.
88 title Create Project-Nokia (Completed)
89 echo.
90 color 17
91 set /p key=Press ENTER to open folder...
92 explorer /select,"%destination%\BuildRelease.bat"
View Code

 

3.制作备份.bat

利用7za.exe根据当前的时间进行源代码备份,可自动生成 exclude.txt 文件,去除源码中不需要备份的部分,也可以对它手动编辑。

需要下载7z的独立命令行工具7za.exe

效果如下:

制作备份.bat

 1 @echo off
 2 rem 说明:
 3 rem slnDir   [必选] 将压缩的文件夹名称
 4 rem slnFile  [可选] 将sln文件名(不含扩展名)设置在“slnFile=”右边
 5 rem password [可选] 打包时使用的密码
 6 ::call 制作备份.bat -noUplayer
 7 ::call 制作备份.bat -onlyUplayer
 8 set slnDir=wp8_v3.7
 9 set slnFile=
10 set password=youku123
11 set output="%slnDir%.%date:~0,4%-%date:~5,2%-%date:~8,2% %time:~0,2%-%time:~3,2%-%time:~6,2%.Src.7z"
12 if "%slnFile%"=="" set slnFile=%slnDir%
13 set exe7z=7za.exe
14 set excludeFile=exclude.txt
15 title 制作备份
16 ::参数
17 if "%1"=="-noUplayer" goto :noUplayer
18 if "%1"=="-onlyUplayer" goto :onlyUplayer
19 goto :start
20 :noUplayer
21 title 制作备份 - NO UPLAYER FOLDER
22 set excludeFile=exclude_noUplayer.txt
23 set output="%slnDir%.nouplayer.%date:~0,4%-%date:~5,2%-%date:~8,2% %time:~0,2%-%time:~3,2%-%time:~6,2%.Src.7z"
24 goto :start
25 :onlyUplayer
26 title 制作备份 - ONLY UPLAYER FOLDER
27 set output="%slnDir%.UPlayer.%date:~0,4%-%date:~5,2%-%date:~8,2% %time:~0,2%-%time:~3,2%-%time:~6,2%.Src.7z"
28 set slnDir="%slnDir%\UPlayer"
29 goto :start
30 :start
31 cls
32 if "%slnDir%"=="" goto :ERR1
33 if not exist %slnDir% goto :ERR1
34 if not exist %exe7z% goto :ERR2
35 if exist %excludeFile% goto :COMPRESS
36 ::生成excludeFile
37 echo .svn\>%excludeFile%
38 echo bin\>>%excludeFile%
39 echo obj\>>%excludeFile%
40 echo PerformanceLogs\>>%excludeFile%
41 echo PerfLogs\>>%excludeFile%
42 echo myfiles\>>%excludeFile%
43 echo packages\>>%excludeFile%
44 echo ipch\>>%excludeFile%
45 echo *.sdf>>%excludeFile%
46 echo Youku.suo>>%excludeFile%
47 echo Youku.v11.suo>>%excludeFile%
48 echo Youku.v12.suo>>%excludeFile%
49 echo Youku.sln.DotSettings.user>>%excludeFile%
50 echo lastmsbuild.log>>%excludeFile%
51 echo Youku_*.sap>>%excludeFile%
52 echo Youku.sdf>>%excludeFile%
53 echo Thumbs.db>>%excludeFile%
54 echo Youku_Debug_AnyCPU.xap>>%excludeFile%
55 echo Youku_Release_AnyCPU.xap>>%excludeFile%
56 if "%1"=="-noUplayer" echo UPlayer\>>%excludeFile%
57 :COMPRESS
58 title 正在备份:%output%
59 if exist %output% del %output% /F /Q
60 if "%password%"=="" (set pwd=) else (set pwd=-p%password%)
61 %exe7z% a -t7z -mx=9 %output% "%slnDir%\" -xr@%excludeFile% -scsWIN %pwd%
62 echo 输出文件:%output%
63 title 备份完成:%output%
64 set /p key=按回车键退出...
65 goto :END
66 :ERR1
67 title 错误 - 制作备份
68 color 0E
69 echo 错误:源文件夹:“%slnDir%” 不存在!
70 echo.
71 echo 请修改slnDir变量,保存后重试。
72 echo.
73 echo 按任意键开始编辑...
74 pause>nul
75 start "" %windir%\notepad.exe "%~0"
76 goto :END
77 :ERR2
78 title 错误 - 制作备份
79 color 0E
80 echo 错误:压缩软件:“%exe7z%”不存在!
81 echo.
82 echo 请检查7z压缩软件,或者编辑批处理修改exe7z变量。
83 echo.
84 echo 按任意键退出...
85 pause>nul
86 goto :END
87 :END
88 exit

 

由于某些比较大的项目更新没有WP源码的更新频繁,每次备份较大的项目需要花费的时间较长,所以对上面的代码中Uplayer是分离出来的。

如图:

 

制作备份_菜单.bat

他会创建 exclude_noUplayer.txt 文件,可手动编辑排除的文件。

 1 @echo off
 2 echo ====== 制作备份 ======
 3 echo 1. noUplayer
 4 echo 2. onlyUplayer
 5 echo 3. 全部(onlyUplayer和onlyUplayer)
 6 echo 4. 全部
 7 echo.
 8 set /p key=请选择:
 9 if "%key%"=="1" call 制作备份.bat -noUplayer
10 if "%key%"=="2" call 制作备份.bat -onlyUplayer
11 if "%key%"=="3" start call 制作备份.bat -noUplayer && call 制作备份.bat -onlyUplayer
12 if "%key%"=="4" call 制作备份.bat

 

 

4. 手动给无线网络启动wifi热点

wifi热点.bat

@echo off
rem 请设置简单的无线热点ssid和密码(8位)
set ssid=TEMP001
set key=88888888
rem -------------------------------------
"%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\SYSTEM" >nul 2>nul
if %errorlevel%==0 goto :start
echo 请以管理员身份运行。
goto :end
:start
color 1f
echo --------------
echo 创建wifi热点
echo --------------
echo.
echo 按任意键开始...
echo.
pause>nul
netsh wlan set hostednetwork mode=allow ssid=%ssid% key=%key%
if errorlevel 1 goto :err1
echo    SSID: %ssid%
echo     KEY: %key%
ping -n 2 127.1>nul
echo.
netsh wlan start hostednetwork
if errorlevel 1 goto :err2
ping -n 2 127.1>nul
echo 请手动设置网络共享,共享给新创建的wifi热点...
start "" ncpa.cpl
goto:end
:err1
echo 配置热点信息失败。
goto :end
:err2
echo 启动热点失败。请尝试:
echo 设备管理器 - 网络适配器 - Microsoft virtual WiFI Miniport Adapter(如果有)
echo 右键-属性,到“驱动程序”页,点“启用”按钮。
start "" devmgmt.msc
goto :end
:end
echo.
echo 按任意键结束...
pause>nul

 

转载于:https://www.cnblogs.com/Bob-wei/p/4489412.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/492291.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

形态学——膨胀

1、基本概念 膨胀是将与目标区域的背景点合并到该目标物中&#xff0c;使目标物边界向外部扩张的处理。 例如&#xff1a; 2、设计思想 设计一个结构元素&#xff0c;结构元素的原点定位在背景像素上&#xff0c;判断是否覆盖有目标点&#xff0c;来确定是否该点被膨胀为目标…

剖析20世纪未来出行 这些畅想21世纪能成吗?

来源&#xff1a;popsci编译&#xff1a; 网易智能 (乐邦)近年来有关飞行汽车、超级高铁、喷气背包、无人驾驶汽车等新型交通工具的报道一直不绝于耳&#xff0c;但目前这些领域的产品似乎都还算不上真正切实可行。说好的移动出行未来在哪里呢&#xff1f;人们梦寐以求的这些交…

图像分割——迭代式阈值分割

1、算法步骤&#xff1a; &#xff08;1&#xff09;预定义两阈值之差dt &#xff08;2&#xff09;选定初始阈值T0&#xff08;一般为图像的平均灰度&#xff09; &#xff08;3&#xff09;用T分割图像为G1、G2两组&#xff0c;G1由灰度值大于T的所有像素组成&#xff0c;…

第一本用机器生成的书籍由施普林格•自然出版

Lithium-Ion BatteriesA Machine-Generated Summary of Current Research来源&#xff1a;Springer丨公众号摘要&#xff1a;这本创新的原型书引人入胜地概述了锂离子电池的最新研究。与德国法兰克福大学应用计算语言学实验室合作开发的一种算法自动编写了这本书。施普林格•自…

根据文件扩展名获取系统图标

1 /// <summary>2 /// 根据文件后缀名获取系统图标。3 /// </summary>4 /// <param name"extension"></param>5 /// <returns></returns>6 public static ImageSource GetIconByExt…

2019全球AI人才分布图:美国占44%,中国人才净流入

来源&#xff1a;网络大数据人工智能技术正在快速发展&#xff0c;而各国对于AI人才的需求是没有止境的&#xff1a;大家都在培养和争夺人才上做文章。前不久&#xff0c;教育部批准了国内35所大学的人工智能本科专业;加拿大正希望通过“全球技能战略签证”吸引国外人才流入。今…

区域生长算法原理及MATLAB实现

1. 基于区域生长算法的图像分割原理 数字图像分割算法一般是基于灰度值的两个基本特性之一&#xff1a;不连续性和相似性。前一种性质的应用途径是基于图像灰度的不连续变化分割图像&#xff0c;比如图像的边缘。第二种性质的主要应用途径是依据实现指定的准则将图像分割为相似…

给初学者们讲解人工神经网络(ANN)

1. 介绍 这份教学包是针对那些对人工神经网络&#xff08;ANN&#xff09;没有接触过、基本上完全不懂的一批人做的一个简短入门级的介绍。我们首先简要的引入网络模型&#xff0c;然后才开始讲解ANN的相关术语。作为一个应用的案例&#xff0c;我们解释了后向传播算法&#x…

最后一场「屏之争」:汽车大佬与硅谷巨头的贴身肉搏

作者 | Tim Higgins 、William Boston来源&#xff1a;机器之能编译摘要&#xff1a;安卓的跨平台生态系统允许用户在手机和车机等不同屏幕上访问他们的数字生活&#xff0c;在去年&#xff0c;它帮助谷歌获得了 820 亿美元的移动广告收入。但在大众 CEO 赫伯特迪斯&#xff08…

对网络体系变革的思考

来源&#xff1a;&#xff1a;中兴摘要&#xff1a;互联网已走过了50年&#xff0c;其发展远远超越了初衷&#xff0c;各类新业务与应用加大了网络体系变革的压力&#xff0c;对网络体系颠覆性的探索和演进创新一直在进行。近年来关于5G网络体系的演进方向逐渐明朗&#xff0c;…

Junit 内部解密之一: Test + TestCase + TestSuite

转自:http://blog.sina.com.cn/s/blog_6cf812be0100wbhq.html nterface: Test 整个测试的的基础接口 Method 1: abstract int countTestCases() 这个方法主要是用来计算要运行的test case的数量的。 Method 2&#xff1a;abstract void run(TestResult result) 这个方法主要是…

数据预测之BP神经网络具体应用以及matlab实现

1.具体应用实例。根据表2&#xff0c;预测序号15的跳高成绩。 表2 国内男子跳高运动员各项素质指标 序号 跳高成绩() 30行进跑(s) 立定三级跳远() 助跑摸高() 助跑4—6步跳高() 负重深蹲杠铃() 杠铃半蹲系数 100 (s) 抓举 () 1 2.24 3.2 9.6 3.45 2.15 1…

谷歌机器人业务重组 花里胡哨没有用 要做实干家

来源&#xff1a; medium 编译 | 网易智能 (乐邦)在机器人领域&#xff0c;谷歌一直都不怎么顺利&#xff0c;尽管在前些年它大举进军&#xff0c;完成了多宗相关的并购交易。最近该公司重组成立Robotics at Google实验室&#xff0c;这对于机器人和智能机器的发展来说是一大步…

BP神经网络识别手写数字项目解析及matlab实现

BP神经网络指传统的人工神经网络&#xff0c;相比于卷积神经网络(CNN)来说要简单些。 人工神经网络具有复杂模式和进行联想、推理记忆的功能, 它是解决某些传统方法所无法解决的问题的有力工具。目前, 它日益受到重视, 同时其他学科的发展, 为其提供了更大的机会。1986 年, Rom…

智能家居市场年增速近30%!苹果看齐亚马逊、谷歌,欲开辟三足鼎立

来源&#xff1a;物联网智库整理摘要&#xff1a;作为世界领先的科技巨头&#xff0c;亚马逊、谷歌和苹果相爱相杀许多年。在智能家居领域&#xff0c;三家的“战争”也会随着市场的成熟而更加激烈。尽管苹果目前稍显落后&#xff0c;但未来市场广阔谁主沉浮仍未可知。近日&…

简单实现UITableView索引功能(中英文首字母索引)(一) ByH罗

UITableView索引功能是常见的,主要是获取中英文的首字母并排序&#xff0c;系统自带获取首字母 //系统获取首字母 - (NSString *) pinyinFirstLetter:(NSString*)sourceString {NSMutableString *source [sourceString mutableCopy];CFStringTransform((__bridge CFMutableStr…

matlab——图像细化

所谓细化&#xff0c;就是从原来的图像中去掉一些点&#xff0c;但仍要保持原来的形状。 1、代码如下&#xff1a; close all;clear all;clc; %关闭所有图形窗口&#xff0c;清除工作空间所有变量&#xff0c;清空命令行 I1imread(circles.png); subplot(1,3,1),imshow(I1);…

中国60家最强汽车初创在此!芯片厂高调入局,智能网联强势霸榜

来源&#xff1a;智东西摘要&#xff1a;中国汽车科技最全地图&#xff01;2018年&#xff0c;知名市场研究机构毕马威再次设立了中国汽车科技领先企业50强和新锐企业10强榜单评选&#xff0c;并在近日公布了结果。备选企业包括在智能网联、汽车后市场服务、汽车制造技术、出行…

专设AI周会 高管悉数到场 微软CEO有多重视人工智能?

来源&#xff1a;CNBC 翻译 | 网易智能 (天门山)据CNBC报道&#xff0c;一般在每周的周四&#xff0c;微软首席执行官萨蒂亚纳德拉(Satya Nadella)和微软高管团队都要在一起开会&#xff0c;讨论该公司越来越多的人工智能&#xff08;AI&#xff09;项目。微软首席技术官凯文斯…

汽车电子:下一个苹果产业链

来源&#xff1a;安信证券摘要&#xff1a;本文将从“7个层级深度解析”这次产业发展红利带来巨大且丰富的投资机遇。汽车电子产业&#xff0c;预计将是继家电、PC和手机之后又一次全产业链级别的大发展机遇&#xff0c;不同的是&#xff1a;1. 其构成产品附加值更高(高稳定/高…