Windows 10: How to use Powershell for simple CMD tools Solved

  1. Posts : 6
    Win 10 pro 64 bit
       22 Sep 2015 #1

    How to use Powershell for simple CMD tools

    I am by no standard a programmer. But in the past, I had a job with a lot of skutwork needed on a daily basis. I.T. was always too busy, and non-I.T. folks were not allowed to do any programming, but the command line and batch stuff was not real programming and was OK for ordinary folks. So, I learned batch, out of necessity over 20 years ago, and became addicted. I would not even dabble with Powershell, except that it has a feature that is frustratingly missing in CMD.exe--Powershell has a command line history that is preserved between sessions.

    I have a toolkit full of little batch files that continue to make my day more comfortable, many run from shortcut icons, but many from the command-line. Many of the DOS commands work just fine in Powershell, but one which I use extensively fails. FOR throws an error. e.g.

    for /f %i in (alpha.txt) do f ...%i%i......

    where "F" is a small batch that I wrote, runs fine at the CMD prompt, but FOR creates confusion for Powershell.

    Any suggestion how I can configure Powershell to treat FOR like a CMD command? (hopefully without going too far into the mysteries of real Powershell lingo.)
      My ComputerSystem Spec

  2. Kari's Avatar
    Posts : 15,055
    Windows 10 Pro
       23 Sep 2015 #2

    I recommend you start with this: Windows PowerShell: Scripting Crash Course | TechNet Magazine. Read it through, it's not too complicated and with your batching background you get it.

    When done continue with this: Conditional Logic Using Loops | PowerShell Pro! :: PowerShell Pro!

      My ComputerSystem Spec

  3. Posts : 6
    Win 10 pro 64 bit
    Thread Starter
       23 Sep 2015 #3

    Thanks Kari. I had composed a long-winded tirade about Powershell and all its irritations, but you got me within sight of my objective. After I had vented, I clicked "Mark Solved" and the forum lost my train of thought. (probably better that way)
      My ComputerSystem Spec

  4. Ztruker's Avatar
    Posts : 6,434
    Windows 10 Pro X64 17134.191
       23 Sep 2015 #4

    Two great links, thanks Kari.
      My ComputersSystem Spec


Related Threads
A simple Guest account? in User Accounts and Family Safety
Hi Guys, I've upgraded to Windows 10 and want a simple Guest account for visitors. The only add users options I have involve my visitors setting up email accounts, etc, which defeats the object of a simple Guest account. I've looked online...
I'm trying to figure out what this PCI simple communications controller is and where can I download the driver for it. I've tried updating it from the device manager, but it tells me driver could not be found and a yellow exclamation icon appears in...
A simple fix for alot of Windows 10 issues in Performance & Maintenance
Since Windows 10 came out alot of people have had issues concerning alot of aspects in Windows 10, i have been serving ppl as a free tech supporter and i thought to include some fixes here, alot of ppl are panicking, and avoid going to a service...
Solved Is uninstall of Win 10 as simple as...? in Installation and Upgrade
Don't panic! :huh: I'm not ready to uninstall Windows 10 just yet but will need to eventually. But, to finish my question; is uninstall of Win 10 as simple as booting into Windows 7, then deleting the Windows 10 partition & re-acquiring that space...
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd
All times are GMT -5. The time now is 07:32.
Find Us