gpt4 book ai didi

Powershell issue - Cannot acess my Desktop inside user\documents folder(PowerShell问题-无法在User\Documents文件夹中访问我的桌面)

转载 作者:bug小助手 更新时间:2023-10-28 09:39:46 24 4
gpt4 key购买 nike



I am currently taking google IT certifications and in the section for becoming a power user for powershell and linux. Im stuck at this one point where im trying to figure out why I cannot follow what she is doing in the video. she is trying to copy a file from documents to desktop but every time I even try to access the Desktop using the tilde or any other method it will not do anything. Im not sure what im doing wrong

我目前正在参加谷歌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

Im not sure if this is an outdated video and maybe there is a new way to do this that im not aware of if im causing the issue myself. any help would be appreciated.

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


更多回答

Do a Get-ChildItem -Path ~ and see what comes up. Is it possible that the Desktop folder location has been moved somewhere else? You can verify your Desktop folder location by typing [System.Environment]::GetFolderPath('Desktop'). If you're not already using a lab enviornment, I recommend using the Windows Sandbox optional feature or a VM when experimenting/learning. This helps a lot when you get to PowerShell remoting and/or setting up a domain lab.

做一个Get-ChildItem-Path~,看看会发生什么。桌面文件夹位置是否可能已移至其他位置?您可以通过输入[System.Environment]::GetFolderPath(‘Desktop’).来验证您的桌面文件夹位置如果您尚未使用实验室环境,我建议您在实验/学习时使用Windows沙盒可选功能或虚拟机。在进行PowerShell远程处理和/或设置域实验室时,这将非常有用。

(New-Object -com shell.application).NameSpace( "shell:ThisPCDesktopFolder" ).Self. Path -- (.OneDrive, perhaps... )

(New-Object -com shell.application).NameSpace(“shell:ThisPCDesktopFolder”). Self.路径--(.OneDrive,也许.)

优秀答案推荐

Your symptoms imply two anomalies in your environment:

您的症状表明您的环境中存在两种异常情况:



  • C:\Users\chaos\Desktop is a file rather than a directory.

  • Conversely, mycoolfile.txt is a directory rather than a file.


更多回答

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com