Python Forum
Windows/Power Shell: Differences from the tutorial...
Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Windows/Power Shell: Differences from the tutorial...
#11
(Oct-08-2016, 12:13 PM)wavic Wrote: Why don't you run mkdir --help or mkdir -h and see which is the proper command

In windows cmd, it would be "help mkdir" or "help md" or "mkdir /?" otherwise you create the directories "--help" or "-h"

Quote:I tried entering in PowerShell, not cmd. It doesn't ignore just the '-p', but rather the whole command returns an error message. I've just tried in in cmd.exe and both "mkdir x/y/z" and "mkdir -p x/y/z" return syntax errors.

It would be helpful to see the actual error message. It could be that PowerShell is running in "restricted mode" and you might need to set it to "unrestricted". You can check this by typing this in PS

get-executionpolicy
if it shows "restricted" you get set it to "unrestricted" by typing this in PS

set-executionpolicy unrestricted
make sure to reset it to the original level when your done testing.

Quote:So am I correct to understand that the maker of the tutorial made a mistake in including the -p in the windows part of the tutorial and saying you can't delete non-empty files?

not entirely 

In windows cmd, you can use "rmdir /s" to remove an entire directory tree.
In PS, you would just use "rmdir" and you will be prompted.

As for the cmd.exe terminal, again it would be helpful to see the actual error message. It's possible the "Command Extensions" are disabled, but that is unlikely since they are enabled by default...but still a possiblity

Sorry forgot to add

Quote:I've just tried in in cmd.exe and both "mkdir x/y/z" and "mkdir -p x/y/z" return syntax errors.

in windows, the 'slashes' are in the opposite direction, so it would be 

[code]
mkdir x\y\z
[\code]

In a python script, the form "x/y/z" would work
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
Reply
#12
(Oct-08-2016, 01:37 PM)sparkz_alot Wrote: In windows cmd, it would be "help mkdir" or "help md" or "mkdir /?" otherwise you create the directories "--help" or "-h"
This is crazy! :D

I can't be in help anymore. I forget everything. I am sorry for my answer.
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#13
(Oct-08-2016, 02:16 PM)wavic Wrote:
(Oct-08-2016, 01:37 PM)sparkz_alot Wrote: In windows cmd, it would be "help mkdir" or "help md" or "mkdir /?" otherwise you create the directories "--help" or "-h"
This is crazy! :D

I can't be in help anymore. I forget everything. I am sorry for my answer.

Welcome to my world  :D
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
Reply
#14
Last time when I used cmd was 10 years ago. Shame on me
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#15
(Oct-08-2016, 01:37 PM)sparkz_alot Wrote:
(Oct-08-2016, 12:13 PM)wavic Wrote: Why don't you run mkdir --help or mkdir -h and see which is the proper command

In windows cmd, it would be "help mkdir" or "help md" or "mkdir /?" otherwise you create the directories "--help" or "-h"

Quote:I tried entering in PowerShell, not cmd. It doesn't ignore just the '-p', but rather the whole command returns an error message. I've just tried in in cmd.exe and both "mkdir x/y/z" and "mkdir -p x/y/z" return syntax errors.

It would be helpful to see the actual error message. It could be that PowerShell is running in "restricted mode" and you might need to set it to "unrestricted". You can check this by typing this in PS

get-executionpolicy
if it shows "restricted" you get set it to "unrestricted" by typing this in PS

set-executionpolicy unrestricted
make sure to reset it to the original level when your done testing.

Quote:So am I correct to understand that the maker of the tutorial made a mistake in including the -p in the windows part of the tutorial and saying you can't delete non-empty files?

not entirely 

In windows cmd, you can use "rmdir /s" to remove an entire directory tree.
In PS, you would just use "rmdir" and you will be prompted.

As for the cmd.exe terminal, again it would be helpful to see the actual error message. It's possible the "Command Extensions" are disabled, but that is unlikely since they are enabled by default...but still a possiblity

Sorry forgot to add

Quote:I've just tried in in cmd.exe and both "mkdir x/y/z" and "mkdir -p x/y/z" return syntax errors.

in windows, the 'slashes' are in the opposite direction, so it would be 

[code]
mkdir x\y\z
[\code]

In a python script, the form "x/y/z" would work

Hey, thanks for your replies.

The error message is in German, but it's something like "The parameter can not be processed, because the parameter name "p" is not unambiguous. Possible matches:-Path -PipelineVariable -LiteralPath.

help mkdir and help rmdir don't show the argument -p, but they do show -path. Typing this seems to be superfluous though.

PS was running in restricted mode, but setting it to unrestricted doesn't seem to have changed anything, so I guess I'll change it back. How do I check if Command Extensions are on?

Also, in both cmd.exe and PS, / is automatically converted to \. Is there any reason to stick to only typing /?
Reply
#16
Yep more about learning basic command line stuff,
and Powershell(not fan of it) only comes up because "Learn Python the Hard Way" use it.
There is many thing i don't like about LPTHW,but not gone take it here.

As mention use cmder,then you have a shell which is closer to shell on Linux.
cmder fit Python and tools needed much better.
You can use many Linux commands and git,ssh,cat..ect work out of the box.
Reply
#17
(Oct-09-2016, 07:10 PM)snippsat Wrote: Yep more about learning basic command line stuff,
and Powershell(not fan of it) only comes up because "Learn Python the Hard Way" use it.
There is many thing i don't like about LPTHW,but not gone take it here.

As i mention use cmder,then you have a shell which is closer to shell on Linux.
cmder fit Python and tools needed much better.
You can use many Linux commands and git,ssh,cat..ect work out of the box.

There is a better way. Sygwin.
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#18
(Oct-09-2016, 07:18 PM)wavic Wrote: There is a better way. Sygwin.
Yes it's okay,but as fast replacement for cmd i think cmder(is Portable) is a better choice.
The shell of cmder look better to.
Reply
#19
You're right. Sygwin is a big package.
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#20
I use Cygwin on the rare occasions i am on windows. Its big because you can choose to select a ton of programs with it. Which usually i want. I usually put cygwin's bin directory in my system path to just execute directly from their command prompt. Powershell seems like a limited version when coming from linux.
Recommended Tutorials:
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Huge black friday power supply sale at EVGA Larz60+ 0 2,072 Nov-21-2018, 08:06 PM
Last Post: Larz60+
  differences between py2 and py3 Skaperen 4 4,345 Feb-10-2018, 09:16 AM
Last Post: Skaperen

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020