MikeyChris
Extraordinary Member
- Joined
- Jan 2, 2012
- Messages
- 40
- Thread Author
-
- #1
OK, before I start, I admit this is old school. That said, we often fall back on things that have worked in the past. I recently installed Win 10 Pro 64 bit and am getting familiar with it. I was wondering how many different .msc commands there were, so I thought I could use the following command to find out (using a command line DIR command, issued from c:\, inside powershell as admin):
dir *.msc /s > mscfiles.txt
When I ran that command and argument, I got this in reply from WIndows:
dir : Second path fragment must not be a drive or UNC name.
Paramater name: path2
At line:1 char:1
+ dir *.msc /s >MSCFile.txt
+ ~~~~~~~~~~~~~~~~~~~
+ CategoryInfo: InvalidArguement (bunch of stuff here)
+ FullyQualifiedErrorID: DirArguementError (more stuff here)
When I ran the same command sans the redirection to the text file (i.e. dir *.msc /s) , it ran fine, but the text blew by too fast to read, of course. Running the PAUSE switch (dir *.msc /s /p) did yield human-readable text (in screen sized chunks), but I want an actual list.
Soooo what am I doing wrong? Is redirection to a text file not supported by the DIR command any more? If I drop the space between msc and the switch (dir *.msc/s> mscfiles.txt) the command runs with no error, but the text file is a zero byte file with no list of msc files (remember the same command sans the redirection did indeed scroll all msc files through at light speed). Any ideas are appreciated.
dir *.msc /s > mscfiles.txt
When I ran that command and argument, I got this in reply from WIndows:
dir : Second path fragment must not be a drive or UNC name.
Paramater name: path2
At line:1 char:1
+ dir *.msc /s >MSCFile.txt
+ ~~~~~~~~~~~~~~~~~~~
+ CategoryInfo: InvalidArguement (bunch of stuff here)
+ FullyQualifiedErrorID: DirArguementError (more stuff here)
When I ran the same command sans the redirection to the text file (i.e. dir *.msc /s) , it ran fine, but the text blew by too fast to read, of course. Running the PAUSE switch (dir *.msc /s /p) did yield human-readable text (in screen sized chunks), but I want an actual list.
Soooo what am I doing wrong? Is redirection to a text file not supported by the DIR command any more? If I drop the space between msc and the switch (dir *.msc/s> mscfiles.txt) the command runs with no error, but the text file is a zero byte file with no list of msc files (remember the same command sans the redirection did indeed scroll all msc files through at light speed). Any ideas are appreciated.
Solution
Based on the error syntax you're trying to run a cmd command in powershell. DIR is an alias in powershell, but it doesn't accept command prompt command argument syntax. So you would want to replace /s with -Recurse
- Joined
- Jul 4, 2015
- Messages
- 8,998
Based on the error syntax you're trying to run a cmd command in powershell. DIR is an alias in powershell, but it doesn't accept command prompt command argument syntax. So you would want to replace /s with -Recurse
MikeyChris
Extraordinary Member
- Joined
- Jan 2, 2012
- Messages
- 40
- Thread Author
-
- #4
OK, I'll (obviously) have to read up on PowerShell. I didn't realize there was a difference between it and a cmd box. However, I ran all of the commands inside powershell, and the other DIR commands I ran (please see original post) ran fine, only the redirection failed. In any case thanx for the tip about mmc. I'll do that.Based on the error syntax you're trying to run a cmd command in powershell. DIR is an alias in powershell, but it doesn't accept command prompt command argument syntax. So you would want to replace /s with -Recurse
- Joined
- Jul 4, 2015
- Messages
- 8,998
Redirection works the same in powershell as in cmd. The error you received was generated by the /s. To see what else is aliased in powershell you can type the following.
Get-ChildItem Alias:
Another important piece of information to note is that cmd is being deprecated in favor of powershell. As of build 1703 (creator update) cmd has been removed from the [windows key + x] menu and I don't think it's in the start menu anymore either.
Get-ChildItem Alias:
Another important piece of information to note is that cmd is being deprecated in favor of powershell. As of build 1703 (creator update) cmd has been removed from the [windows key + x] menu and I don't think it's in the start menu anymore either.
MikeyChris
Extraordinary Member
- Joined
- Jan 2, 2012
- Messages
- 40
- Thread Author
-
- #6
Yeah my system just did the build 1703 update last night, and today I have another issue too. When I first start up, instead of the usual screen, I get a message that the user or password is incorrect, like windows was trying to do an auto login. Now I have a new issue!Redirection works the same in powershell as in cmd. The error you received was generated by the /s. To see what else is aliased in powershell you can type the following.
Get-ChildItem Alias:
Another important piece of information to note is that cmd is being deprecated in favor of powershell. As of build 1703 (creator update) cmd has been removed from the [windows key + x] menu and I don't think it's in the start menu anymore either.
MikeyChris
Extraordinary Member
- Joined
- Jan 2, 2012
- Messages
- 40
- Thread Author
-
- #8
Sorry to take so long to reply - been having many other computer issues. I actually checked that reg entry right away and it was set to zero, so I don't know what is causing the "incorrect password" message. I am running UTW and thought there may be some issue with that, but can't locate a problem. It's not a big deal, just another aggravationIn the registry go here HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
If 'AutoAdminLogon' is set to 1, change it to 0
MikeyChris
Extraordinary Member
- Joined
- Jan 2, 2012
- Messages
- 40
- Thread Author
-
- #10
I'm using an MS account.
MikeyChris
Extraordinary Member
- Joined
- Jan 2, 2012
- Messages
- 40
- Thread Author
-
- #11
BTW, I was playing around, and found if I open a PS box, then run CMD (inside the PS box), I can run: dir *.msc /s >MSCFile.txt and get my list.Based on the error syntax you're trying to run a cmd command in powershell. DIR is an alias in powershell, but it doesn't accept command prompt command argument syntax. So you would want to replace /s with -Recurse
Similar threads
- Replies
- 1
- Views
- 2K
- Replies
- 0
- Views
- 726