ANSCII 的意思是“ASCII/ANSI”
抱歉,管理员,我应该去哪个 Stack Exchange 站点解决这些问题?
我在 Google 上到处寻找 Batch/Powershell ANSCII 艺术生成器,但找不到任何东西可以为我完成这项工作,而且制作 ANSCII 艺术非常困难。而且我不仅使用预定义的 ANSCII Art,还使用用户/变量定义。像这样:
C:\> set var = "ANSI Test"
C:\> ansi %var%
?????? ???? ?????????????? ??????????????????????????????????
????????????? ?????????????? ??????????????????????????????????
?????????????? ?????????????? ??? ?????? ???????? ???
????????????????????????????? ??? ?????? ???????? ???
??? ?????? ????????????????? ??? ???????????????? ???
??? ?????? ???????????????? ??? ???????????????? ???
Run Code Online (Sandbox Code Playgroud)
或者
PS $var = "ANSI Test"
PS ansi $var
?????? ???? ?????????????? ??????????????????????????????????
????????????? ?????????????? ??????????????????????????????????
?????????????? ?????????????? ??? ?????? ???????? ???
????????????????????????????? …Run Code Online (Sandbox Code Playgroud) 我正在尝试编写一个 powershell 脚本(它将定期运行),用于打开 Outlook 的新电子邮件窗口,其中包含填充了一些数据的“to”、“subject”和“body”。
我找到了一种从 powershell 发送邮件的方法,但您必须从 powershell 发送它。这不符合需要,因为我必须编辑邮件正文。
$Outlook = New-Object -ComObject Outlook.Application
$Mail = $Outlook.CreateItem(0)
$Mail.To = "random.dude@email.com"
$Mail.Subject = "data for Subject"
$Mail.Body ="Example of body..."
$Mail.Send()
Run Code Online (Sandbox Code Playgroud)
基本上我需要的是$Mail.Show()打开一个新的电子邮件弹出窗口,其中包含预填充的数据
powershell不是必需的,它只是能够操纵前景的接缝,所以我尝试了它。
我有一个场景,我需要将 powershell 路径构建为$RemotePath = '$($env:USERPROFILE)\Desktop\Shell.lnk'. 这个变量被传递到需要执行的远程机器。远程机器将其作为字符串变量接收。如何扩展要评估的字符串$env:USERPROFILE?
I'm using Nreco PDFGenerator to generate PDFs using the following PowerShell script:
$PdfGenerator = "$((Get-Location).Path)\lib\NReco.PdfGenerator.dll"
$Assembly = [Reflection.Assembly]::LoadFrom($PdfGenerator)
$PdfCreator = New-Object NReco.PdfGenerator.HtmlToPdfConverter
$PdfCreator.PageHeight = 297
$PdfCreator.PageWidth = 210
$PdfCreator.Zoom = 2
$pdfBytes = $PdfCreator.GeneratePdf([string](gc myhtml.htm))
Add-Content -Value $pdfBytes -Encoding byte -Path "./mypdf.pdf"
Run Code Online (Sandbox Code Playgroud)
myhtml.htm is a simple HTML document:
<html>
<head>
<title>Hello World</title>
<body>
<img src='./img/FancyImage.jpg' alt='Fancy Image' />
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
Everything looks perfectly fine, except that the images are missing...
Any ideas are welcome!
我正在尝试创建一个包装另一个函数的 PowerShell 函数。我希望我的函数采用可变数量的参数并将它们传递给包装的函数。有没有办法做到这一点?
具体来说,我想做的是这样的:
function MakeRequest() {
if ($session) {
$resp = Invoke-WebRequest -WebSession $session $args
} else {
$resp = Invoke-WebRequest -SessionVariable session $args
}
$resp
}
Run Code Online (Sandbox Code Playgroud) 说我有以下 xml
<?xml version="1.0"?>
<catalog>
<book id="bk101">
<author>Gambardella, Matthew</author>
</book>
<book id="bk102">
<author>Ralls, Kim</author>
</book>
<book id="bk103">
<author>Corets, Eva</author>
</book>
</catalog>
Run Code Online (Sandbox Code Playgroud)
我有一个 xmlNode 代表我从文件中读入的整个文件
$myXml=New-Object XML
$myXml.Load("path to the books file")
Run Code Online (Sandbox Code Playgroud)
然后我如何选择具有“bk102”id 值的书元素,然后我可以将该 Xmlnode 传递给另一个需要 XMlNode 的函数?
即我的新节点将是:
$Node = <book id="bk102">
<author>Ralls, Kim</author>
</book>
Run Code Online (Sandbox Code Playgroud)
谢谢大家。整个上午都在挣扎。
我在使用 powershell 时遇到了一个小问题,这可能很容易……如果我从控制台运行命令而不是从 .ps1 文件运行命令,我会得到不同的行为。命令;
New-PSDrive -PSProvider FileSystem -Name X -Root \\computer_name\x -Persist
Run Code Online (Sandbox Code Playgroud)
如果我从控制台运行它,我会得到我想要的行为,即出现在文件管理器中的持久 X: 驱动器。如果我从一个只包含这一行的脚本运行它,我就不会得到永久驱动器。
有什么想法吗?
有没有办法在不使用 Powershell 安装 Excel 的情况下将 .xls 转换为 .csv?
我无法在特定机器上访问 Excel,因此在尝试时出现错误:
New-Object -ComObject excel.application
Run Code Online (Sandbox Code Playgroud)
新对象:检索具有 CLSID {00000000-0000-0000-0000-000000000000} 的组件的 COM 类工厂由于以下错误而失败:80040154 类未注册(来自 HRESULT 的异常:0x80040154)。
我想看看使用 Robocopy 的解决方案是否比使用Get-ChildItem获取给定文件夹(和子文件夹......)内的文件列表更快。
在我的代码中,我使用Get-ChildItemcmdlet 来获取特定文件夹内所有文件的列表,以便在每个文件上循环:
$files = Get-ChildItem "C:\aaa" -Recurse | where {! $_.PIsContainer} # ! because I don't want to list folders
foreach ($file in $files){
...
}
Run Code Online (Sandbox Code Playgroud)
现在,我有 robocopy 命令来获取所有文件的列表,但是,robocopy 的输出是一个字符串。
[string]$result = robocopy "C:\aaa" NULL /l /s /ndl /xx /nc /ns /njh /njs /fp
Run Code Online (Sandbox Code Playgroud)
那么,我如何使用 robocopy 命令的输出来循环每个文件(类似于使用Get-ChildItem?
我正在寻找解决方案来解决使用 Powershell v4 创建 tar.gz 存档的问题。我找不到由 Microsoft 创建或验证以提供此类功能的扩展/数据包。是否存在这样的解决方案 [tar-ing 和 gzip-ing]?
powershell ×10
batch-file ×1
cmd ×1
cmdlets ×1
email ×1
excel ×1
outlook ×1
robocopy ×1
xml ×1