简体   繁体   中英

Powershell & Plink - formatting commands

I'm trying to push some commands to plink from within a powershell script.

I have it working, except if there is a space in the file name.

$entry.name = "File with a space.txt"

$SSH_Source = "/share/USBDisk1"

$Files = $SSH_Source+$entry.Name

When I push $Files to plink it truncates after the space in the file name.

I need it to output like this with the single quotes so that plink works correctly.

/share/USBDisk1/'File with a space.txt'

Thank in advance,

像这样?

$entry.name = "'File with a space.txt'"

Don't you want to be doing something like:

$entryname = "File with a space.txt"
$SSH_Source = "/share/USBDisk1"
$Files = '"' + $SSH_Source + '/' + $entryname + '"'
$Files

You want the quotes around the full path, something like:

"/share/USBDisk1/File with a space.txt"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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