Powershell 问题 - 无法访问用户\文档文件夹中的我的桌面

问题描述 投票:0回答:1

我目前正在参加 google IT 认证,并参加成为 powershell 和 Linux 高级用户的部分。我陷入了这一点,我试图弄清楚为什么我无法理解她在视频中所做的事情。她试图将文件从文档复制到桌面,但每次我什至尝试使用波浪号或任何其他方法访问桌面时,它都不会执行任何操作。我不确定我做错了什么

PS C:\Users\chaos\Documents> ls


    Directory: C:\Users\chaos\Documents


    Mode                 LastWriteTime         Length Name
    ----                 -------------         ------ ----
    d-----          9/9/2023  12:03 PM                mycoolfile.txt
    -a----          5/1/2017   1:26 PM          31423 Cover letter Prototype.docx
    -a----         1/29/2017   4:48 PM          11510 Document 1.docx


PS C:\Users\chaos\Documents> cp mycoolfile.txt C:\Users\chaos\Desktop\
cp : Cannot create "C:\Users\chaos\Desktop" because a file or directory with the same name already exists.
At line:1 char:1
+ cp mycoolfile.txt C:\Users\chaos\Desktop\
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : WriteError: (C:\Users\chaos\Desktop\:String) [Copy-Item], IOException
    + FullyQualifiedErrorId : CreateDirectoryIOError,Microsoft.PowerShell.Commands.CopyItemCommand

PS C:\Users\chaos\Documents> cd ~\Desktop
cd : Cannot find path '~\Desktop' because it does not exist.
At line:1 char:1
+ cd ~\Desktop
+ ~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (~\Desktop:String) [Set-Location], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.SetLocationCommand

我不确定这是否是一个过时的视频,也许有一种新的方法可以做到这一点,但我不知道是否是我自己造成了这个问题。任何帮助将不胜感激。

powershell directory settings desktop
1个回答
0
投票

您的症状意味着您的环境存在两种异常情况:

  • C:\Users\chaos\Desktop
    是一个 文件 而不是目录。
  • 相反,
    mycoolfile.txt
    是一个目录而不是文件。
© www.soinside.com 2019 - 2024. All rights reserved.