Powershell

Nov 30, 2010 14:51

Powershell's errors are incredibly verbose. Unfortunately they're also content-free, making them completely useless.

Leave a comment

maekern November 30 2010, 22:40:55 UTC
Example?

Reply

praecorloth November 30 2010, 22:44:35 UTC
mount z: "\\server\share\"

New-PSDrive : Cannot find a provider with the name '\\server\share'. The name is not in the proper format
. A provider name may only be alpha-numeric characters or a Windows PowerShell snap-in name followed by a single '\' followed by alpha-numeric characters.
At line:1 char:6
+ mount <<<< z: "\\server\share"
+ CategoryInfo : ObjectNotFound: (\\server\share:String) [New-PSDrive], ProviderNotFoundException
+ FullyQualifiedErrorId : ProviderNotFoundBadFormat,Microsoft.PowerShell.Commands.NewPSDriveCommand

Sorry if the paste is fail. Y'know, Windows command shells 'n all that.

Reply

chardin December 1 2010, 00:54:43 UTC
Did you remove the double quotes from the "\\server\share\" thing?

Reply

praecorloth December 1 2010, 00:58:05 UTC
Y'know, I didn't do that. But it wouldn't make sense for me to try that since neither PowerShell nor cmd recognize paths with spaces in them if you don't have them in quotes.

Reply

chardin December 1 2010, 00:59:00 UTC
So there's no way to shell-escape a space?

Reply

praecorloth December 1 2010, 01:01:59 UTC
Actually, no I did try without the quotes. I tried the Linux way of escaping a space.

mount z: \\server\spaced/ path\

That didn't work either.

Reply

chardin December 1 2010, 01:03:49 UTC
Try a caret rather than a backslash.

Reply

praecorloth December 1 2010, 01:11:31 UTC
I shall. Though it's odd that various PowerShell commands would be perfectly alright using "\\server\spaced path\" and one particular command would not be alright with it. Though that does line up with the way many other commands operate in cmd and PowerShell.

Reply

chardin December 1 2010, 01:13:50 UTC
My intuition, which is inchoate and ill-founded, is that by quotifying an argument, you render it a string rather than an object name.

This is a little like me saying: "I am not 'Chuck Hardin'. That is a sequence of phonemes. I am a person whose name happens to sound like 'Chuck Hardin' in an oral rendition." Then you hit me in the face.

In short, if the command is doing this, you should hit it. In the face.

Reply

praecorloth December 6 2010, 19:36:31 UTC
Okay, follow up to this.

Removing the " does avoid the particular error I was having. Trying to use a caret, however, doesn't seem to escape the space as I'm getting a network path not found. But that's being thrown by the net set of commands itself rather than powershell getting it's icky, mucky, filthy hands all over the error message.

Reply

chardin December 6 2010, 23:07:16 UTC
Powershell's escape character may be a backquote; try that before the space.

Reply


Leave a comment

Up