<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>CMD.exe compatibility</title><link>http://blogs.msdn.com/powershell/archive/2007/05/22/cmd-exe-compatibility.aspx</link><description>A few weeks ago I was getting Mark Russinovich up and running on PowerShell. While he liked the power the new model afforded him, he was frustrated because a bunch of things that were simple in CMD.EXE where now either hard or not available. I forget</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: CMD.exe compatibility</title><link>http://blogs.msdn.com/powershell/archive/2007/05/22/cmd-exe-compatibility.aspx#2782829</link><pubDate>Tue, 22 May 2007 07:33:39 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2782829</guid><dc:creator>Aaron Margosis</dc:creator><description>&lt;p&gt;Yes and no. &amp;nbsp;&amp;quot;Yes&amp;quot; because now I can use all the CMD DIR options that I'm used to. &amp;nbsp;&amp;quot;No&amp;quot; because it turns all the output into straight text, defeating the purpose of being in PowerShell.&lt;/p&gt;
&lt;p&gt;I agree with you - I don't want your team diverted from working on more important stuff. &amp;nbsp;But a community effort should be able to make a great &amp;quot;function dir&amp;quot; replacement for &amp;quot;alias dir&amp;quot;.&lt;/p&gt;</description></item><item><title>re: CMD.exe compatibility</title><link>http://blogs.msdn.com/powershell/archive/2007/05/22/cmd-exe-compatibility.aspx#2785275</link><pubDate>Tue, 22 May 2007 09:51:35 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2785275</guid><dc:creator>Richard Siddaway</dc:creator><description>&lt;p&gt;This is a good idea. &amp;nbsp;What may be helpful especially to new PowerShell users is a set of functions that could add directly into their profile to do this sort of thing for the commonest DOS commands that are likely to be required&lt;/p&gt;</description></item><item><title>re: CMD.exe compatibility</title><link>http://blogs.msdn.com/powershell/archive/2007/05/22/cmd-exe-compatibility.aspx#2790511</link><pubDate>Tue, 22 May 2007 14:22:34 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2790511</guid><dc:creator>Maximilian Hänel</dc:creator><description>&lt;p&gt;A compromise between old cmd style and the new PowerShell object orientation might be a function like this:&lt;/p&gt;
&lt;p&gt;function dir(cmd /c dir /b $args) | foreach{[System.IO.FileInfo](Convert-Path $_)}&lt;/p&gt;
&lt;p&gt;Now you can type dir /ah and one still gets FileInfo objects back. Wow, it's so easy to get only hidden files ;-) &lt;/p&gt;
&lt;p&gt;Don't get me wrong, I love PowerShell, but Get-Childitem is by far the hardest thing to learn in PowerShell.&lt;/p&gt;</description></item><item><title>re: CMD.exe compatibility</title><link>http://blogs.msdn.com/powershell/archive/2007/05/22/cmd-exe-compatibility.aspx#2791780</link><pubDate>Tue, 22 May 2007 15:34:29 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2791780</guid><dc:creator>shaka</dc:creator><description>&lt;p&gt;if ($args -ne $null) { $all = $args } else { $all = $input }&lt;/p&gt;
&lt;p&gt;cmd /c $all&lt;/p&gt;</description></item><item><title>re: CMD.exe compatibility</title><link>http://blogs.msdn.com/powershell/archive/2007/05/22/cmd-exe-compatibility.aspx#2793778</link><pubDate>Tue, 22 May 2007 17:21:56 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2793778</guid><dc:creator>Jim Foster</dc:creator><description>&lt;p&gt;Maybe I am missing something here, but how about extending some of these existing commands, like Get-ChildItem, to handle those DOS-like items? Perhaps the new parameter names would be more PowerShell like (that is, not /q, but something more meaningful).&lt;/p&gt;
&lt;p&gt;Now, I know that Get-ChildItem can be used for things other than the file system, but some of the other information stores that Get-ChildItem can query also have owners too (in this case), like Get-ChildItem HKCU:\. &amp;nbsp;Where the parameter does not make sense like Get-ChildItem Env:\, the parameter could either be ignored or an appropriate error issued.&lt;/p&gt;
&lt;p&gt;I have probably just over-simplified this whole process, but I thought I would pitch my idea none the less.&lt;/p&gt;</description></item><item><title>re: CMD.exe compatibility</title><link>http://blogs.msdn.com/powershell/archive/2007/05/22/cmd-exe-compatibility.aspx#2794624</link><pubDate>Tue, 22 May 2007 18:18:17 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2794624</guid><dc:creator>PowerShellTeam</dc:creator><description>&lt;p&gt;&amp;gt; Maybe I am missing something here, but how about extending some of these existing commands, like Get-ChildItem, to handle those DOS-like items? &lt;/p&gt;
&lt;p&gt;We can and it is on the list of things to do. &amp;nbsp;That said, here is the reality of how these things work. &amp;nbsp;We keep lists of all the things that we want to do for a release. &amp;nbsp;That list comes from us, our partners, our customers etc. &amp;nbsp;Then we decide upon the THEMEs for a release. &amp;nbsp;Think of this as &amp;quot;What will the newspaper say about the next release?&amp;quot;. &amp;nbsp;We then prioritize the list of things we want to do based upon how they support those themes. &amp;nbsp;After that, we look at the input from customers and figure out how we can address as much of it as possible. &amp;nbsp;There is no fixed algorithm for how teams do this and frankly we've tried a few approaches (dedicate a milestone to this, let people do it catch-as-catch can, etc) and we're going to continue to experiment because we value responding to customers highly. &amp;nbsp;All that said, no matter what we do, there will be things that don't make the cut line for a release. &amp;nbsp;&amp;quot;To ship is to choose.&amp;quot;&lt;/p&gt;
&lt;p&gt;So will we try to get this done? Definately.&lt;/p&gt;
&lt;p&gt;Will it get done? &amp;nbsp;I don't know.&lt;/p&gt;
&lt;p&gt;This should point out how important it is for the community to speak up and let us know what is important to you. &amp;nbsp;We look at every request that comes in. &amp;nbsp;Common sense will tell you that if we see 100 people asking for feature 1 and 5 people asking for feature 2, feature 1 has a higher probably of getting done. &amp;nbsp;Ergo - even though you know that something has been requested, you should request it or vote for that item.&lt;/p&gt;
&lt;p&gt;Jeffrey Snover [MSFT]&lt;/p&gt;
&lt;p&gt;Windows Management Partner Architect&lt;/p&gt;
&lt;p&gt;Visit the Windows PowerShell Team blog at: &lt;a rel="nofollow" target="_new" href="http://blogs.msdn.com/PowerShell"&gt;http://blogs.msdn.com/PowerShell&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Visit the Windows PowerShell ScriptCenter at: &lt;a rel="nofollow" target="_new" href="http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx"&gt;http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx&lt;/a&gt; &lt;/p&gt;
</description></item><item><title>re: CMD.exe compatibility</title><link>http://blogs.msdn.com/powershell/archive/2007/05/22/cmd-exe-compatibility.aspx#2795721</link><pubDate>Tue, 22 May 2007 19:23:44 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2795721</guid><dc:creator>Frisky</dc:creator><description>&lt;p&gt;Thanks to Mark Russinovich for getting you guys' to think this through. And so simple... :)&lt;/p&gt;
&lt;p&gt;Frisky&lt;/p&gt;</description></item><item><title>re: CMD.exe compatibility</title><link>http://blogs.msdn.com/powershell/archive/2007/05/22/cmd-exe-compatibility.aspx#2797070</link><pubDate>Tue, 22 May 2007 20:41:25 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2797070</guid><dc:creator>Carl Klemmer</dc:creator><description>&lt;p&gt;This kind of issue has left me dissapointed with PowerShell's performance thus far as an interactive shell. &amp;nbsp;CMD and csh commands have option and formatting choices that have been refined over many years. &amp;nbsp;I don't want to have to rewrite these myself. &amp;nbsp;And while it's cool that I can just use the old DIR inside powershell, what I really want is a new dir with all the formatting and options of the old dir, along with the object features that let it be leveraged in the powershell environment. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;I'd love to see a default compatibility pack providing CMD like formatting and options, as well as optional packs mimicking other popular shells.&lt;/p&gt;</description></item><item><title>re: CMD.exe compatibility</title><link>http://blogs.msdn.com/powershell/archive/2007/05/22/cmd-exe-compatibility.aspx#2797401</link><pubDate>Tue, 22 May 2007 21:05:20 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2797401</guid><dc:creator>PowerShellTeam</dc:creator><description>&lt;P&gt;The PowerShell Community Extensions project provides functions that provide some of the features you might be looking for:&lt;/P&gt;
&lt;P&gt;$content = Get-Content "c:/Program Files/PowerShell Community Extensions/Profile/Dir.ps1"&lt;/P&gt;
&lt;P&gt;$xmlContent = $("&amp;lt;XML&amp;gt;"; ($content -match "###") -replace "###",""; "&amp;lt;/XML&amp;gt;" | Out-String)&lt;/P&gt;
&lt;P&gt;$xml = [xml] $xmlContent&lt;/P&gt;
&lt;P&gt;$xml.XML.Function | Format-List Name,Description&lt;/P&gt;
&lt;P&gt;name &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;: dirx&lt;/P&gt;
&lt;P&gt;Description :&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DIRX is an extended dir function that is used by dird, dirs and dirt.&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; It provides shortcuts for displaying files/dirs with particular&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; attributes. &amp;nbsp;For more information execute "dirx -?".&lt;/P&gt;
&lt;P&gt;name &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;: dird&lt;/P&gt;
&lt;P&gt;Description :&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Displays just containers (directories).&lt;/P&gt;
&lt;P&gt;name &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;: dirw&lt;/P&gt;
&lt;P&gt;Description :&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Displays folder contents in wide format.&lt;/P&gt;
&lt;P&gt;name &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;: dirs&lt;/P&gt;
&lt;P&gt;Description :&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Displays folder contents sorted by size descending.&lt;/P&gt;
&lt;P&gt;name &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;: dirt&lt;/P&gt;
&lt;P&gt;Description :&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Displays folder contents sorted by time descending.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Lee&lt;/P&gt;</description></item><item><title>re: CMD.exe compatibility</title><link>http://blogs.msdn.com/powershell/archive/2007/05/22/cmd-exe-compatibility.aspx#2797924</link><pubDate>Tue, 22 May 2007 21:42:22 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2797924</guid><dc:creator>Brian Reiter</dc:creator><description>&lt;p&gt;This same trick works great for accessing classic UNIX commands that run under SFU/SUA/Interix.&lt;/p&gt;
&lt;p&gt;#aliasing functions for SUA unix utilities&lt;/p&gt;
&lt;p&gt;function dig { &amp;amp; &amp;quot;$env:systemroot\posix.exe&amp;quot; /u /c /bin/dig $args }&lt;/p&gt;
&lt;p&gt;#By invoking xterm via /bin/sh we get an environment set up before xterm starts (good for xterm -e ssh foo)&lt;/p&gt;
&lt;p&gt;#function xterm { &amp;amp; &amp;quot;$env:systemroot\psxrun.exe&amp;quot; -u -p /usr/local/bin/xterm -- xterm $args }&lt;/p&gt;
&lt;p&gt;function xterm { &amp;amp; &amp;quot;$env:systemroot\psxrun.exe&amp;quot; -u /bin/sh -l -c &amp;quot;/usr/local/bin/xterm $args&amp;quot; }&lt;/p&gt;
&lt;p&gt;For statically linked PSXSS binaries you can also hard-link them to /common where foo links to foo.exe. &lt;/p&gt;
&lt;p&gt;For example whois could be a function:&lt;/p&gt;
&lt;p&gt;function dig { &amp;amp; &amp;quot;$env:systemroot\posix.exe&amp;quot; /u /c /usr/local/bin/whois $args }&lt;/p&gt;
&lt;p&gt;-or-&lt;/p&gt;
&lt;p&gt;% ln /usr/local/bin/whois /common/whois.exe&lt;/p&gt;
&lt;p&gt;Since C:\SFU or C:\Windows\SUA is automatically put into the PATH environmental variable when SFU or SUA respectively is installed the hard link option gets you a two-fer: it works in CMD.EXE and PowerShell.&lt;/p&gt;</description></item><item><title>re: CMD.exe compatibility</title><link>http://blogs.msdn.com/powershell/archive/2007/05/22/cmd-exe-compatibility.aspx#2798968</link><pubDate>Tue, 22 May 2007 22:55:50 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2798968</guid><dc:creator>Joku</dc:creator><description>&lt;p&gt;Could you make a blog entry about why the copy function of the PS window imitates that of CMD in that the content is stays wrapped in the copy.&lt;/p&gt;
&lt;p&gt;That's what annoys about cmd the most really and it's in PS too, run some command like say tracert and use the mouse/quickedit to copy it then paste to somewhere and it looks like this:&lt;/p&gt;
&lt;p&gt; &amp;nbsp;8 &amp;nbsp; &amp;nbsp;12 ms &amp;nbsp; &amp;nbsp;13 ms &amp;nbsp; &amp;nbsp;13 ms &amp;nbsp;gi3-3.ar1.ARN3.gblx.net [67.&lt;/p&gt;
&lt;p&gt;17.196.241]&lt;/p&gt;
&lt;p&gt; &amp;nbsp;9 &amp;nbsp; 105 ms &amp;nbsp; 105 ms &amp;nbsp; 105 ms &amp;nbsp;qwest-1.ar3.JFK1.gblx.net [2&lt;/p&gt;
&lt;p&gt;08.50.13.170]&lt;/p&gt;
&lt;p&gt; 10 &amp;nbsp; 108 ms &amp;nbsp; 107 ms &amp;nbsp; 107 ms &amp;nbsp;jfk-core-02.inet.qwest.net [&lt;/p&gt;
&lt;p&gt;205.171.30.57]&lt;/p&gt;
&lt;p&gt; 11 &amp;nbsp; 123 ms &amp;nbsp; 122 ms &amp;nbsp; 123 ms &amp;nbsp;atl-core-02.inet.qwest.net [&lt;/p&gt;
&lt;p&gt;67.14.14.14]&lt;/p&gt;
&lt;p&gt;What's the usability scenario where this behaviour is preferred over the other? Usually Microsoft is good in getting things right for the common scenario and not optimizing for the edge/corner cases? I know you can pipe output to file and so on but it's just way too often that I'd actually want to copy something already on the screen that this issue should simply go on being ignored.&lt;/p&gt;</description></item><item><title>re: CMD.exe compatibility</title><link>http://blogs.msdn.com/powershell/archive/2007/05/22/cmd-exe-compatibility.aspx#2805874</link><pubDate>Wed, 23 May 2007 06:04:17 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2805874</guid><dc:creator>Vinicius Canto [MVP]</dc:creator><description>&lt;p&gt;Great! But there are a lot of options and commands to create wrapper-funcions. I gave an example of this some months ago, when I wrote about DIR /AD command and its Powershell replacement, the ugly get-childItem | ? {$_.PSIsContainer}&lt;/p&gt;
&lt;p&gt;[]s,&lt;/p&gt;
&lt;p&gt;--&lt;/p&gt;
&lt;p&gt;Vinicius Canto &amp;lt;scripterbr_at_gmail_dot_com&amp;gt;&lt;/p&gt;
&lt;p&gt;MVP Visual Developer - Scripting&lt;/p&gt;
&lt;p&gt;MCP Windows 2000 Server, Windows XP e SQL Server 2000&lt;/p&gt;
&lt;p&gt;Blog sobre Scripting: &lt;a rel="nofollow" target="_new" href="http://viniciuscanto.blogspot.com"&gt;http://viniciuscanto.blogspot.com&lt;/a&gt;&lt;/p&gt;</description></item><item><title>re: CMD.exe compatibility</title><link>http://blogs.msdn.com/powershell/archive/2007/05/22/cmd-exe-compatibility.aspx#2821247</link><pubDate>Wed, 23 May 2007 22:03:52 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2821247</guid><dc:creator>Query</dc:creator><description>&lt;p&gt;I'm curious about how the old Doskey macro utility interacts with cmd.exe and the win32 console. &lt;/p&gt;
&lt;p&gt;It's my understanding that in NT based systems, Doskey is merely an interface for accessing functionality built into the win32 console. But if that is the case, why don't certain funcitons work in powershell? &lt;/p&gt;
&lt;p&gt;For example, the command doskey /history prints out the command buffer in cmd, but not in psh. Yet, creating a macro using the switch /exename=powershell.exe will work even to the extent of overriding psh aliases. &lt;/p&gt;
&lt;p&gt;My question is: are the doskey macros handled by the console itself and, if so, would there be an easy way to migrate them to psh aliases?&lt;/p&gt;</description></item><item><title>re: CMD.exe compatibility</title><link>http://blogs.msdn.com/powershell/archive/2007/05/22/cmd-exe-compatibility.aspx#2858341</link><pubDate>Fri, 25 May 2007 06:03:30 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2858341</guid><dc:creator>Jeffery Hicks</dc:creator><description>&lt;p&gt;I use the DIR switches all the time. &amp;nbsp;I have to confess that I take the lazy way and use &lt;/p&gt;
&lt;p&gt;cmd /c dir /a-d&lt;/p&gt;
&lt;p&gt;when in PowerShell. &amp;nbsp;I like to type as few characters as possible.&lt;/p&gt;</description></item><item><title>assoc</title><link>http://blogs.msdn.com/powershell/archive/2007/05/22/cmd-exe-compatibility.aspx#6093777</link><pubDate>Sun, 11 Nov 2007 12:07:41 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6093777</guid><dc:creator>1</dc:creator><description>&lt;p&gt;hi ...&lt;/p&gt;
&lt;p&gt;do tink about this problem in mi sistem..?&lt;/p&gt;
&lt;p&gt;this comand : assoc .exe=.exe&lt;/p&gt;
&lt;p&gt;thank you..&lt;/p&gt;
&lt;p&gt;ithoo.kish@yahoo.com&lt;/p&gt;</description></item><item><title>re: CMD.exe compatibility</title><link>http://blogs.msdn.com/powershell/archive/2007/05/22/cmd-exe-compatibility.aspx#9433064</link><pubDate>Thu, 19 Feb 2009 05:29:52 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9433064</guid><dc:creator>Larry Weiss</dc:creator><description>&lt;p&gt;Here's what I do. &amp;nbsp;I define a file named&lt;/p&gt;
&lt;p&gt;&amp;quot;~.bat&amp;quot; in the PATH as these two lines&lt;/p&gt;
&lt;p&gt;@echo off&lt;/p&gt;
&lt;p&gt;%*&lt;/p&gt;
&lt;p&gt;Thereafter I can just do&lt;/p&gt;
&lt;p&gt;~ dir /q&lt;/p&gt;
&lt;p&gt;at a Powershell prompt.&lt;/p&gt;
&lt;p&gt;There's nothing magic about the name &amp;quot;~&amp;quot;, but I find it conveniently terse. &amp;nbsp;It allows me access to all the cmd.exe supported internal commands.&lt;/p&gt;
&lt;p&gt; - Larry Weiss, lfw@airmail.net&lt;/p&gt;</description></item></channel></rss>