How can I install and use ack library on Windows?

2019-03-07 18:26发布

I have never used Perl, but I am really impressed by the ack, which I would like to use for source code searching, etc.

Can anyone guide me of how to make use of this excellent library on Windows?

标签: windows perl ack
9条回答
萌系小妹纸
2楼-- · 2019-03-07 18:47

Nothing worked for me, until I went to the ack website and saw this.

enter image description here

And I ran the following command in cmd prompt:

choco install ack
查看更多
淡お忘
3楼-- · 2019-03-07 18:53

If you already have msysgit installed, then you don't need to install Perl, because you already have a version. You just need to download the standalone version of ack and put it somewhere in your bash path1. You can then run ack from your msysgit bash prompt.

If you also want to be able to run ack from the Windows command prompt, then you will need to create a batch script somewhere in your Windows path2 with the contents:

@"C:\Program Files\Git\bin\perl" C:\path\to\ack-standalone.pl %*

(You'll obviously need to edit the paths above to match your msysgit installation and where you placed the ack script.)

1: I just stuck mine in the mysysgit bin directory: C:\Program Files\Git\bin\ack. This isn't the most sensible location for it, but it works.
2: Again, I just created the file ack.bat in the msysgit bin directory C:\Program File\Git\bin.

查看更多
姐就是有狂的资本
4楼-- · 2019-03-07 18:56

Depending on how you feel about installing pre-built binaries from open source projects, you might also consider The Silver Searcher (ag). It's ack-compatible and faster than ack. It's also available on Linux from the repositories in recent distros.

http://blog.kowalczyk.info/software/the-silver-searcher-for-windows.html

查看更多
登录 后发表回答