Can you share what you are doing, most likely a syntax issue but without seeing it, it is hard to diagnose
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
So hi everyone! I am new here, and I arrived because of a problem I am having with the powershell. Basically it seems very reluctant at executing Powershell commands, for example for the Set-Location command to change directory. I tried to put "" and later '' on the path, putting and removing the -Path appendix, anything, but it is not executing the command. And plus, it does not even show an error it just doesn't do anything. I added Powershell before the command, because otherwise it was giving me an error regarding not understanding what the command was, hence suggesting that now that the error is gone it knows what command is but cannot execute it. I really need for obvious reasons that this command works ahah! So if anybody could give some hints would be amazing, but for now thank even just for reading! Have a good one,
Stefano
Can you share what you are doing, most likely a syntax issue but without seeing it, it is hard to diagnose
I'm stuck in the user directory.
You're in a command prompt and running Powershell and telling it to execute a command. PS runs the command and then terminates. That leaves you back in the command prompt and whatever directory that it has set.
Just run powershell. Then in the "PS prompt" enter the commands.
Oh wow thanks a lot it is now moving from one directory to another! I may ask another thing and then quit, now if I ls the directory I finally got in, I receive an error message for not having the permission
Besides asking for this error, clearly I have not a clear idea of what the powershell is doing, can you suggest me a reading or a topic for understaning it? How does it differentiate from the linux shell? I need to learn this stuff. Thank you a lot again!
Powershell is Microsoft's shell solution to replace the original command prompt, cmd.exe. You will find many common Linux shell commands are avaiable. These are aliases to PS cmdlets. If you just run Powershell from the Windows start menu it will open and the default directory will be your user account's home directory. From there your ls command should work. If not, then you've done something with accounts or directory permissions. I have no way of knowing what you did.
You can list the aliases like this.
PS C:\Users\madne> get-alias
CommandType Name Version Source
----------- ---- ------- ------
Alias % -> ForEach-Object
Alias ? -> Where-Object
Alias ac -> Add-Content
Alias asnp -> Add-PSSnapin
Alias cat -> Get-Content
Alias cd -> Set-Location
Alias CFS -> ConvertFrom-String 3.1.0.0 Microsoft.PowerShell.Utility
Alias chdir -> Set-Location
Alias clc -> Clear-Content
Alias clear -> Clear-Host
Alias clhy -> Clear-History
Alias cli -> Clear-Item
Alias clp -> Clear-ItemProperty
Alias cls -> Clear-Host
Alias clv -> Clear-Variable
Alias cnsn -> Connect-PSSession
Alias compare -> Compare-Object
Alias copy -> Copy-Item
Alias cp -> Copy-Item
Alias cpi -> Copy-Item
Alias cpp -> Copy-ItemProperty
Alias curl -> Invoke-WebRequest
Alias cvpa -> Convert-Path
Alias dbp -> Disable-PSBreakpoint
Alias del -> Remove-Item
...
PS C:\Users\madne> get-help ls
NAME
Get-ChildItem
SYNOPSIS
Gets the items and child items in one or more specified locations.
SYNTAX
Get-ChildItem [[-Filter] <System.String>] [-Attributes {Archive | Compressed | Device | Directory | Encrypted |
Hidden | IntegrityStream | Normal | NoScrubData | NotContentIndexed | Offline | ReadOnly | ReparsePoint |
SparseFile | System | Temporary}] [-Depth <System.UInt32>] [-Directory] [-Exclude <System.String[]>] [-File]
[-Force] [-Hidden] [-Include <System.String[]>] -LiteralPath <System.String[]> [-Name] [-ReadOnly] [-Recurse]
[-System] [-UseTransaction] [<CommonParameters>]
Get-ChildItem [[-Path] <System.String[]>] [[-Filter] <System.String>] [-Attributes {Archive | Compressed | Device
| Directory | Encrypted | Hidden | IntegrityStream | Normal | NoScrubData | NotContentIndexed | Offline | ReadOnly
| ReparsePoint | SparseFile | System | Temporary}] [-Depth <System.UInt32>] [-Directory] [-Exclude
<System.String[]>] [-File] [-Force] [-Hidden] [-Include <System.String[]>] [-Name] [-ReadOnly] [-Recurse]
[-System] [-UseTransaction] [<CommonParameters>]
DESCRIPTION
The `Get-ChildItem` cmdlet gets the items in one or more specified locations. If the item is a container, it gets
the items inside the container, known as child items. You can use the Recurse parameter to get items in all child
containers and use the Depth parameter to limit the number of levels to recurse.
For more info see:
https://docs.rackspace.com/blog/powershell-101-from-a-linux-guy/