powershell

0,多条命令一起执行:

shell
cd /data && ls
PowerShell: (cd C:\) -and (dir)

这样,在PowerShell中,我们也可以顺序执行多条命令了。

 

用分号也可以,; ,但这样的话,就没有前边的语句必须成功的语义,和linux里的;是一样的。而-and 是和Linux的&&一样的语义

 

1,类grep,叫findstr

ansible antiy -m win_shell -a 'wmic process|findstr DEBUG' 

 

2,获取进程cmdline,可以用wmic这个工具

wmic process

 

3,查看文件md5

certutil -hashfile filename md5   

 

4,文件操作Remove-Item

使用ansible 远程删除文件:

Remove-Item -Path "D:\scandir" -Recurse
New-Item -Path 'd:\scandir' -ItemType Directory

 

5,创建目录

mkdir D:\falcon-go-windows-agent

ansible批量创建目录:

ansible windows -m win_shell -a 'mkdir D:\\falcon-go-windows-agent'

posted @ 2022-02-28 15:37  mmgithub123  阅读(112)  评论(0)    收藏  举报