Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【开源自荐】PowerGPT - 无需懂PowerShell就可以在Windows命令行做任何事情 #2980

Open
ouromoros opened this issue Mar 9, 2023 · 0 comments

Comments

@ouromoros
Copy link

写PowerShell脚本需要一定的专业知识,有时也较为麻烦,但我们常常会有在Windows下用进行批量操作的需求。

PowerGPT是一个纯PowerShell编写的轻量工具,只需要打出PowerGPT <要执行的任务>就可以让AI帮你编写命令并执行。

安装十分简单,在PowerShell中运行:

Install-Module PowerGPT

首次运行时需要输入OpenAI API Key,在国内环境下时需要打开系统代理。

$ .\PowerGPT.ps1 "print first lines and last lines for each file in current folder"
The description is too vague, do you mean:
[0] For each file in current directory, print the first line and then print the last line of the file.
[1] For each file in current directory, print the first line of the file. After that, for each file, print the last line of the file.
Choose one description that matches your task: : 1
Will execute script:
-----
Get-ChildItem | ForEach-Object {
    $file = $_.FullName
    Write-Host "First line of $file:"
    Get-Content $file -TotalCount 1
}
Get-ChildItem | ForEach-Object {
    $file = $_.FullName
    Write-Host "Last line of $file:"
    Get-Content $file -Tail 1
}
-----
continue?([y]es, [n]o)
-----

Github: https://github.com/ouromoros/PowerGPT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants