高性能in-memory分布式平台-Hazelcast

简介

Hazelcast is a clustering and highly scalable data distribution platform.

Hazelcast 提供了分布式数据结构处理和其他In-Memory计算,最简单的,它可以很容易的实现java并发包的ConcurrentHashMap来支持JVM的多线程访问操作,但Haze了cast要做的绝不止这样,以下为Hazelcast的宏伟蓝图:

所以Hazelcast支持众多不同平台体系,并提供了企业定制的高级功能。

特性

Hazelcast是Java编写的开源实现,支持Java6\7\8 SE,并提供弹性,冗余和高性能的特性。

快速开始

Hazelcast保持了单一引用的jar包,所以很容易上手,如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
引入Maven依赖:
<dependency>
<groupId>com.hazelcast</groupId>
<artifactId>hazelcast</artifactId>
<version>${hazelcast.version}</version>
</dependency>
简单实现多线程可并发的HashMap:

Map<String, Customer> mapCustomers = Hazelcast.getMap("customers");
mapCustomers.put("1", new Customer("Joe", "Smith"));
mapCustomers.put("2", new Customer("Ali", "Selam"));
mapCustomers.put("3", new Customer("Avi", "Noyan"));

Collection<Customer> colCustomers = mapCustomers.values();
for (Customer customer : colCustomers) {
// process customer
}

参考

Hazelcast官方文档

版本控制工具-Git

简介

Git是目前最为流行的分布式版本控制工具之一,有别于VCS、SVN等集中式版本控制系统,Git不需要单独提供集中管控的服务器,因此不存在单点故障或导致服务器数据丢失的致命缺陷。

分布式版本控制体系

分布式版本控制体系,英文全称Distributed Version Control System,简称 DVCS。
特点:

  • 记录快照而非差异
  • 本地保存完整镜像

常用命令

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
31
32
33
34
35
36
37
38
39
40
41
42
usage: git [--version] [--help] [-C <path>] [-c name=value]
[--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
[-p | --paginate | --no-pager] [--no-replace-objects] [--bare]
[--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
<command> [<args>]

These are common Git commands used in various situations:

start a working area (see also: git help tutorial)
clone Clone a repository into a new directory
init Create an empty Git repository or reinitialize an existing one

work on the current change (see also: git help everyday)
add Add file contents to the index
mv Move or rename a file, a directory, or a symlink
reset Reset current HEAD to the specified state
rm Remove files from the working tree and from the index

examine the history and state (see also: git help revisions)
bisect Use binary search to find the commit that introduced a bug
grep Print lines matching a pattern
log Show commit logs
show Show various types of objects
status Show the working tree status

grow, mark and tweak your common history
branch List, create, or delete branches
checkout Switch branches or restore working tree files
commit Record changes to the repository
diff Show changes between commits, commit and working tree, etc
merge Join two or more development histories together
rebase Reapply commits on top of another base tip
tag Create, list, delete or verify a tag object signed with GPG

collaborate (see also: git help workflows)
fetch Download objects and refs from another repository
pull Fetch from and integrate with another repository or a local branch
push Update remote refs along with associated objects

'git help -a' and 'git help -g' list available subcommands and some
concept guides. See 'git help <command>' or 'git help <concept>'
to read about a specific subcommand or concept.

配置

1
2
3
4
5
6
7
8
9
10
$ git config --list
初次使用推荐配置
$ git config --global user.name "xxx"
$ git config --global user.email xxx@xxx.com
配置默认文本编辑器
$ git config --global core.editor emacs [可选vim, vi等]
配置默认差异比较工具
$ git config --global merge.tool vimdiff [可选kdiff3,tkdiff,meld,xxdiff,emerge,vimdiff,gvimdiff,ecmerge,和 opendiff 等]
更多参考
$ git help config

入门

1
2
3
4
5
6
7
8
9
10
初始化,将当前项目纳入版本控制
$ git init
添加文件到版本控制
$ git add *.js
$ git add README
$ git add --all
查看当前版本状态
$ git status
提交变更
$ git commit -m "comment"

克隆

1
2
3
4
克隆仓库项目至本地,默认新建repo目录
$ git clone git://git.repo.com/repo.git
克隆仓库至本地指定目录
$ git clone https://github.com/dyfeelme/dyfeelme.github.io blog

gitignore

如果想要让git忽略某些不关心或者不适合提交到版本控制的文件或目录,则需要通过配置.gitignore文件来指定。

1
2
3
4
5
6
7
8
9
10
11
用户级别的gitignore,一般存放在用户目录下,当然也可以在.gitconfig中指定其他位置。项目自定义的则存放于项目根目录(与.git目录同级),如下:
$ cat ~/.gitignore
*.swp
build
.DS_store
如上为用户级别的gitignore,指定了所有以.swp为后缀的文件,build目录和.DS_store目录。
$ cat project/.gitignore
.settings
build
*.iso
如上为项目级别的gitignore,其中指定了.settings目录,build目录和所有以.iso为后缀的镜像文件。

规则如下:

所有空行或者以注释符号 # 开头的行都会被 Git 忽略。
可以使用标准的 glob 模式匹配。 匹配模式最后跟反斜杠(/)说明要忽略的是目录。 要忽略指定模式以外的文件或目录,可以在模式前加上惊叹号(!)取反。
所谓的 glob 模式是指 shell 所使用的简化了的正则表达式。星号(*)匹配零个或多个任意字符;[abc] 匹配任何一个列在方括号中的字符(这个例子要么匹配一个 a,要么匹配一个 b,要么匹配一个 c);问号(?)只匹配一个任意字符;如果在方括号中使用短划线分隔两个字符,表示所有在这两个字符范围内的都可以匹配(比如[0-9] 表示匹配所有 0 到 9 的数字)。

比较

1
2
$ git diff 比较当前文件和暂存区域快照的差异
$ git diff --cache 或 --staged 比较暂存区域和上次提交版本快照的差异

移除&重命名

1
2
3
4
5
移除
$ git rm file 将文件从已跟踪文件清单中移除,区别于直接rm命令删除
重命名
$ git mv file newfile 重名名文件,虽然git不像svn等会记录文件改名操作,但git通过以下命令组合完成了改名操作
$ mv file newfile && git rm file && git add newfile

日志

1
2
3
4
5
6
7
8
9
10
11
$ git log 查看提交日志
可选参数
-p 按补丁格式显示每个更新之间的差异。
--stat 显示每次更新的文件修改统计信息。
--shortstat 只显示 --stat 中最后的行数修改添加移除统计。
--name-only 仅在提交信息后显示已修改的文件清单。
--name-status 显示新增、修改、删除的文件清单。
--abbrev-commit 仅显示 SHA-1 的前几个字符,而非所有的 40 个字符。
--relative-date 使用较短的相对时间显示(比如,“2 weeks ago”)。
--graph 显示 ASCII 图形表示的分支合并历史。
--pretty 使用其他格式显示历史提交信息。可用的选项包括 oneline,short,full,fuller 和 format(后跟指定格式)。

撤销

1
$ git reset

远程仓库

1
2
3
4
5
$ git remote 列出每个远程库的简短名字
origin
-v 选项(译注:此为 --verbose 的简写,取首字母),显示对应的克隆地址
$ git remote -v
origin https://github.com/dyfeelme/dyfeelme.github.io

分支

合并

进阶

参考

Git命令

Windows终端神器Cmder

简介

Cmder作为Windows命令提示符的替代者,可谓神级应用,没有之一。
当然它是基于开源神器ConEmu的,也算是集大成者吧。
所以如果你还没有转向macos,或linux之流,拥有如iTerm2之类的终端神器,
那cmder你值得拥有。

快捷键

作为神器,你当然必须要知道驾驭它的要领,也就是快捷键,下面列出了几个最常用或者最酷炫的快捷键

1
2
3
4
Ctrl + `  [全局快捷键] 显示或隐藏Cmder至任务栏
Ctrl + t 新建一个Tab页,带选项
Alt + enter 全屏切换
Ctrl + w 关闭当前Tab,会弹出提示,确认关闭

更多请查看官方文档

配置

邮件标题栏,或者使用快捷键Win+Alt+p打开设置面板,如图:
Setting

  • 添加自定义Task

Startup -> Tasks 点击’+’,添加一个默认的Task。

  • 设置环境变量

Startup -> Environment 在面板逐行添加环境变量。

问题

版本1.2.9 对 Virtualbox 5.0.16 可能 以上不兼容,具体原因不详,换用1.3.0beta版解决。

使用Hexo打造个人博客

简介

hexo 是一款基于nodejs搭建轻博客的快速构建器,支持多种风格、插件,一键部署等功能。

初始化

1
$ npm install hexo-cli -g

基本命令

1
2
3
4
5
6
7
8
清理数据文件
$ hexo clean
生成静态文件
$ hexo generate 或者 hexo g
启动本地服务
$ hexo server 或者 hexo s
部署
$ hexo deploy 或者 hexo d

使用主题

选择一款自己喜欢的主题,将主题文件添加至themes目录,通过配置_config.yml来启用新主题,注意:如果博客已经通过git管理,则需要通过以下命令将主题仓库包含至本仓库,如下:

1
$ git submodule add [主题仓库] themes/主题名

部署

  1. 安装部署插件

    1
    $ npm install hexo-deployer-git --save
  2. 配置
    编辑 _config.yml,github pages配置如下:

    1
    2
    3
    4
    5
    ## Docs: https://hexo.io/docs/deployment.html
    deploy:
    type: git
    repository: git@github.com:dyfeelme/dyfeelme.github.io.git
    branch: master
  3. 部署到Githup Pages
    仓库规划
    因为我们需要将博客直接通过username.github.io作为域名发布,根据官方文档,需要将源代码另存分支,部署文件提交至master分支上。如下操作:

    1
    2
    3
    4
    5
    6
    7
    8
    创建Github SSH 私钥
    $ cd ~/.ssh && ssh-keygen -t rsa -C "dyfeelme@gmail.com"
    $ cat ~/.ssh/id_rsa.pub
    将id_rsa.put中内容拷贝,并在github账号管理中"SSH and GPG keys"菜单中新增信任项。
    新建gh-pages分支,将原代码提交至此分支
    通过上文配置的部署插件,运行:
    $ hexo d
    命令将自动将部署文件发布至master分支,注意:会覆盖原先提交至masters上的所有代码。

Linux命令小记-SCP

概述

SCP(Secure Copy)远程安全拷贝,是一个不需要通过FTP,WEB等额外服务就可以完成终端之间文件传输的命令行工具。

命令

  • 获取远程服务器上的文件
1
$ scp -P 2222 username@ip:/path/filename local_filename
  • 获取远程服务器上的目录
1
$ scp -P 2222 -r username@ip:/path/ local_dir
  • 将本地文件传输至服务器指定目录
1
$ scp -P 2222 local_file username@ip:/path/filename
  • 将本地目录传输至服务器指定目录
1
$ scp -P 2222 -r local_dir username@ip:/path/

参数

1
2
3
4
5
6
7
-v 用来显示进度,查看连接,认证,或是配置错误。

-C 使能压缩选项。

-4 强行使用 IPV4 地址。

-6 强行使用 IPV6 地址。

Docker 入门

简介

我从14年年底开始关注docker容器生态的发展,短短两年见识了Docker的几近“燎原之势”,感慨互联网之迅猛之余,想着也该写篇文章来记录一下我的Docker成长之路。一切都将从那个炎热的中午开始…

安装

目前docker的最新版本为1.10.3
linux(ubuntu)

1
2
3
$ sudo apt-get update && sudo apt-get install curl
$ curl -fsSL https://get.docker.com/gpg | sudo apt-key add -
$ curl -fsSL https://get.docker.com | sh

windows
可以通过choco包管理器安装详情

1
2
3
4
5
6
7
8
9
10
11
12
13
cinst docker -y
cinst docker-machine -y
cinst docker-compose -y
可以通过下载[Docker Toolbox](https://github.com/docker/toolbox/releases/download/v1.10.3/DockerToolbox-1.10.3.exe)安装,Toolbox集成了Docker Engine,docker-machine,docker-compose以及Kitematic Beta版
注:安装前,请先安装依赖的virtualbox。

macos
同windows
mac用户可以通过homebrew管理器安装
```bash
$ brew install docker
$ brew install docker-machine
$ berw install docker-compose

或者homebrew cask安装Docker Toolbox

1
$brew cask install dockertoolbox

或者通过下载Docker Toolbox安装

命令概览

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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
Usage: docker [OPTIONS] COMMAND [arg...]
docker daemon [ --help | ... ]
docker [ --help | -v | --version ]

A self-sufficient runtime for containers.

Options:

--config=~/.docker Location of client config files
-D, --debug Enable debug mode
-H, --host=[] Daemon socket(s) to connect to
-h, --help Print usage
-l, --log-level=info Set the logging level
--tls Use TLS; implied by --tlsverify
--tlscacert=~/.docker/ca.pem Trust certs signed only by this CA
--tlscert=~/.docker/cert.pem Path to TLS certificate file
--tlskey=~/.docker/key.pem Path to TLS key file
--tlsverify Use TLS and verify the remote
-v, --version Print version information and quit

Commands:
attach Attach to a running container
build Build an image from a Dockerfile
commit Create a new image from a container's changes
cp Copy files/folders between a container and the local filesystem
create Create a new container
diff Inspect changes on a container's filesystem

events Get real time events from the server
exec Run a command in a running container
export Export a container's filesystem as a tar archive
history Show the history of an image
images List images
import Import the contents from a tarball to create a filesystem image
info Display system-wide information
inspect Return low-level information on a container or image
kill Kill a running container
load Load an image from a tar archive or STDIN
login Register or log in to a Docker registry
logout Log out from a Docker registry
logs Fetch the logs of a container
network Manage Docker networks
pause Pause all processes within a container
port List port mappings or a specific mapping for the CONTAINER
ps List containers
pull Pull an image or a repository from a registry
push Push an image or a repository to a registry
rename Rename a container
restart Restart a container
rm Remove one or more containers
rmi Remove one or more images
run Run a command in a new container
save Save an image(s) to a tar archive
search Search the Docker Hub for images
start Start one or more stopped containers
stats Display a live stream of container(s) resource usage statistics
stop Stop a running container
tag Tag an image into a repository
top Display the running processes of a container
unpause Unpause all processes within a container
update Update resources of one or more containers
version Show the Docker version information
volume Manage Docker volumes
wait Block until a container stops, then print its exit code

Run 'docker COMMAND --help' for more information on a command.

常用命令

搜索镜像
docker search image_name
列出本地镜像
docker images
拉取镜像
docker pull [(url:port/)image_name(:tag)]
构建镜像
docker build [Dockerfile目录]
运行镜像
docker run -d image_name
docker run -ti image_name /bin/bash
停止容器
docker stop contain_name
删除容器
docker rm [contain_name]
删除镜像
docker rmi image_name
给镜像打tag
docker tag contain_name tagname

docker machine

命令概览

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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
Usage: docker-machine.exe [OPTIONS] COMMAND [arg...]

Create and manage machines running Docker.

Version: 0.6.0, build e27fb87

Author:
Docker Machine Contributors - <https://github.com/docker/machine>

Options:
--debug, -D Enable debug mode
-s, --storage-path "C:\Users\Admin\.docker\machine" Configures storage path [$MACHINE_STORAGE_PATH]
--tls-ca-cert CA to verify remotes against [$MACHINE_TLS_CA_CERT]
--tls-ca-key Private key to generate certificates [$MACHINE_TLS_CA_KEY]
--tls-client-cert Client cert to use for TLS [$MACHINE_TLS_CLIENT_CERT]
--tls-client-key Private key used in client TLS auth [$MACHINE_TLS_CLIENT_KEY]
--github-api-token Token to use for requests to the Github API [$MACHINE_GITHUB_API_TOKEN]
--native-ssh Use the native (Go-based) SSH implementation. [$MACHINE_NATIVE_SSH]
--bugsnag-api-token BugSnag API token for crash reporting [$MACHINE_BUGSNAG_API_TOKEN]
--help, -h show help
--version, -v print the version

Commands:
active Print which machine is active
config Print the connection config for machine
create Create a machine
env Display the commands to set up the environment for the Docker client
inspect Inspect information about a machine
ip Get the IP address of a machine
kill Kill a machine
ls List machines
provision Re-provision existing machines
regenerate-certs Regenerate TLS Certificates for a machine
restart Restart a machine
rm Remove a machine
ssh Log into or run a command on a machine with SSH.
scp Copy files between machines
start Start a machine
status Get the status of a machine
stop Stop a machine
upgrade Upgrade a machine to the latest version of Docker
url Get the URL of a machine
version Show the Docker Machine version or a machine docker version
help Shows a list of commands or help for one command

Run 'docker-machine.exe COMMAND --help' for more information on a command.

docker compose

命令概览

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
31
32
33
34
Define and run multi-container applications with Docker.

Usage:
docker-compose [-f=<arg>...] [options] [COMMAND] [ARGS...]
docker-compose -h|--help

Options:
-f, --file FILE Specify an alternate compose file (default: docker-compose.yml)
-p, --project-name NAME Specify an alternate project name (default: directory name)
--verbose Show more output
-v, --version Print version and exit

Commands:
build Build or rebuild services
config Validate and view the compose file
create Create services
down Stop and remove containers, networks, images, and volumes
events Receive real time events from containers
help Get help on a command
kill Kill containers
logs View output from containers
pause Pause services
port Print the public port for a port binding
ps List containers
pull Pulls service images
restart Restart services
rm Remove stopped containers
run Run a one-off command
scale Set number of containers for a service
start Start services
stop Stop services
unpause Unpause services
up Create and start containers
version Show the Docker-Compose version information

YML文件

打造自己的windows开发环境

简介

Chocolatey NuGet is a Machine Package Manager, somewhat like apt-get, but built with Windows in mind.
喜大普奔的记下这个良心之作chocolatey

安装

打开CMD命令提示符,执行以下命令

1
@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin

或者打开PowerShell窗口,执行以下命令

1
iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))

注意:执行之前请设置powershell执行权限,通过管理员身份启动powershell执行环境,输入如下命令:

1
Set-ExecutionPolicy RemoteSigned

命令概览

输入choco –help打印命令

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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
This is a listing of all of the different things you can pass to choco.

Commands

* list - lists remote or local packages
* search - searches remote or local packages (alias for list)
* install - installs packages from various sources
* version - [DEPRECATED] will be removed in v1 - use `cup <pkg|all> -whatif` instead
* pin - suppress upgrades to a package
* update - [DEPRECATED] RESERVED for future use (you are looking for upgrade, these are not the droids you are looking for)
* upgrade - upgrades packages from various sources
* outdated - retrieves packages that are outdated. Similar to upgrade all --noop
* uninstall - uninstalls a package
* source - view and configure default sources
* sources - view and configure default sources (alias for source)
* feature - view and configure choco features
* features - view and configure choco features (alias for feature)
* unpackself - have chocolatey set it self up
* pack - packages up a nuspec to a compiled nupkg
* push - pushes a compiled nupkg
* new - generates files necessary for a chocolatey package
* apikey - retrieves or saves an apikey for a particular source
* setapikey - retrieves or saves an apikey for a particular source (alias for apikey)
* config - Retrieve and configure config file settings


Please run chocolatey with `choco command -help` for specific help on
each command.

How To Pass Options / Switches

You can pass options and switches in the following ways:

* `-`, `/`, or `--` (one character switches should not use `--`)
* **Option Bundling / Bundled Options**: One character switches can be
bundled. e.g. `-d` (debug), `-f` (force), `-v` (verbose), and `-y`
(confirm yes) can be bundled as `-dfvy`.
* ***Note:*** If `debug` or `verbose` are bundled with local options
(not the global ones above), some logging may not show up until after
the local options are parsed.
* **Use Equals**: You can also include or not include an equals sign
`=` between options and values.
* **Quote Values**: When you need to quote things, such as when using
spaces, please use apostrophes (`'value'`). In cmd.exe you may be
able to use just double quotes (`"value"`) but in powershell.exe
you may need to either escape the quotes with backticks
(`` `"value`" ``) or use a combination of double quotes and
apostrophes (`"'value'"`). This is due to the hand off to
PowerShell - it seems to strip off the outer set of quotes.
* Options and switches apply to all items passed, so if you are
installing multiple packages, and you use `--version=1.0.0`, choco
is going to look for and try to install version 1.0.0 of every
package passed. So please split out multiple package calls when
wanting to pass specific options.

Default Options and Switches

常用命令

检索远程可用包

1
choco search ruby

安装软件

1
2
3
cinst ruby -y
choco install ruby -y
choco install ruby -y --force

卸载软件

1
choco uninstall ruby

配置

1
2
3
choco config list
choco config get key
choco config key value

配置

配置包安装路径
可以通过设置环境变量ChocolateyBinRoot来改变,如图
Setting
配置包缓存路径
可以通过运行以下命令

1
choco config set cacheLocation [path]

配置代理
可以通过运行以下命令

1
2
3
choco config set proxy [url:port]
choco config set proxyUser [username]
choco config set proxyPassword [password]

更多

进阶

分享我自己的环境初始化脚本,参考官方文档:
文件名:setup.psl

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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
function Install-NeededFor {
param(
[string] $packageName = ''
,[bool] $defaultAnswer = $true
)
if ($packageName -eq '') {return $false}

$yes = '6'
$no = '7'
$msgBoxTimeout='-1'
$defaultAnswerDisplay = 'Yes'
$buttonType = 0x4;
if (!$defaultAnswer) { $defaultAnswerDisplay = 'No'; $buttonType= 0x104;}

$answer = $msgBoxTimeout
try {
$timeout = 10
$question = "Do you need to install $($packageName)? Defaults to `'$defaultAnswerDisplay`' after $timeout seconds"
$msgBox = New-Object -ComObject WScript.Shell
$answer = $msgBox.Popup($question, $timeout, "Install $packageName", $buttonType)
}
catch {
}

if ($answer -eq $yes -or ($answer -eq $msgBoxTimeout -and $defaultAnswer -eq $true)) {
write-host "Installing $packageName"
return $true
}

write-host "Not installing $packageName"
return $false
}


# Install Chocolatey
if (Install-NeededFor 'chocolatey') {
iex ((new-object net.webclient).DownloadString('http://chocolatey.org/install.ps1'))
#set choco
$cacheRoot = 'D:\cache'
setx CacheRoot $cacheRoot
$cachePath = Join-Path $cacheRoot 'chocolatey'
choco config set cacheLocation $cachePath
#set system env
$chocoBinRoot = 'C:\ChocoBinRoot'
setx ChocolateyBinRoot $chocoBinRoot
if (!(Test-Path $chocoBinRoot)) {
md $chocoBinRoot
}
}

if (Install-NeededFor 'chocolateygui') {
cinst chocolateygui -y
}

# install nuget, ruby.devkit, and ruby if they are missing
cinst nuget.commandline -y

if (Install-NeededFor 'ruby / ruby devkit') {
cinst ruby -version 2.2.2 -y
cinst ruby2.devkit -y
}


# restore the nuget packages
$nugetConfigs = Get-ChildItem '.\\' -Recurse | ?{$_.name -match "packages\\.config"} | select
foreach ($nugetConfig in $nugetConfigs) {
Write-Host "restoring packages from $($nugetConfig.FullName)"
nuget install $($nugetConfig.FullName) /OutputDirectory packages
}

调用以上脚本
文件名:start.cmd

1
2
3
4
@echo off
SET DIR=%~dp0%
@PowerShell -NoProfile -ExecutionPolicy unrestricted -Command "& '%DIR%setup.ps1' %*"
pause

小结

不说啦,只能帮你到这儿了。

,