1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| @echo off setlocal enabledelayedexpansion
:: 设置NuGet CLI的路径 set NUGET_CLI_PATH=C:\Users\用户目录\.nuget\packages\nuget.commandline\4.6.2\tools\NuGet.exe
:: 设置包含.nupkg文件的目录路径 set PACKAGES_DIRECTORY=D:\packages
:: 设置私有NuGet服务器的上传URL set NUGET_SERVER_URL=https://服务器地址/v3/index.json
:: 设置用于上传的API密钥 set API_KEY=happyyutong
:: 开始上传过程 echo Uploading .nupkg files from %PACKAGES_DIRECTORY% to %NUGET_SERVER_URL%... for %%f in ("%PACKAGES_DIRECTORY%\*.nupkg") do ( echo Uploading %%~nxf... "%NUGET_CLI_PATH%" push "%%f" -Source "%NUGET_SERVER_URL%" -ApiKey %API_KEY% if errorlevel 1 ( echo Failed to upload %%~nxf ) else ( echo Successfully uploaded %%~nxf ) )
echo All done. endlocal pause
|