繁体   English   中英

如何在Powershell中将单引号和逗号放在字符串中

[英]how to put single quotes and a coma to a string in powershell

我试图将单引号用逗号放在行尾,但不知道如何实现。 到目前为止,我只能在逗号​​的末尾加上单引号,但是我也想在行的开头加上单引号。 有人可以帮忙吗

我想实现“ test1”,但目前我只能做“ test1”,

#Define Variables
$a = 'P:\Powershell practice\Movefolder\LD.txt'
$b = get-content $a

#Define Functions
function append-text { 
 process{
 foreach-object {$_ + "',"}
} 
}

#Process Code
$b | append-text

这个?

function append-text { 
process{
foreach-object {"'" + $_ + "',"}
} 
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM