The DOS box is dead, long live the DOS box!
Except we now call it Windows PowerShell 1.0. Originally codenamed "Monad", Windows PowerShell is a replacement for the old familiar DOS command prompt. It provides a command line interface with Windows but is claimed to be a major advance.
PowerShell works with both Vista and XP SP2 but is bundled with neither. It is though freely available for download from Microsoft here.
At first I was quite enthusiastic about PowerShell. Far better to have a modern scripting shell, made of the same fabric as current versions of Windows, than some stale leftover from 16 bit DOS.
Having taken my first few tentative steps, I set about creating the PowerShell equivalent of a DOS batch file. It would be an interesting learning process to, say, migrate my command line solution for video encoding to the new scripting medium.
I soon discovered the PowerShell equivalent of the .bat file is the .ps1 file. Simple experiment: put a PowerShell command such as "get-process" in a text file, save and rename so it has a .ps1 extension, double-click and it should run. But it just opens as a text file.
A bad sign. The .ps1 extension does not become associated with PowerShell when you install the latter. You can of course associate .ps1 with PowerShell manually. I tried that, double-clicked, PowerShell opened .... (yes! yes!) ... then a load of red error messages appeared for a couple of microseconds and PowerShell closed again.
Apparently there is no way to run a PowerShell script by double-clicking a script file in an explorer window. You have to launch PowerShell manually and then run the script explicitly, giving its full pathname. This is for security reasons. It's all explained here and is all about preventing "command hijacking".
No wonder the .ps1 file extension does not get associated with PowerShell. There's no point if you can't run a script by clicking on the file.
Well I'm delighted that PowerShell is so secure, but less thrilled that it's so inconvenient to use. So inconvenient as to make it all but useless. What is the point of a scripting language if you can't use it to make life easier by replacing a series of commands with a simple click? Am I missing something?
I'm well aware of the security issues, including command hijacking, but there must be a better way to stop hackers dead in their tracks than crippling the scripting system to the point where it's more trouble than it's worth to use it.
What is Microsoft's strategy here? Do they want to promote the new and safer PowerShell and phase out the old DOS box? You'd think so. To achieve that they need to encourage users to adopt PowerShell by promoting it and making it easy to use. But there is scant publicity and the security lock-down is a killer. Meantime the DOS box is still there with all its security vulnerabilities.
Which of the two do Microsoft expect real people to use? How does releasing a technologically up to date, secure but inconvenient new scripting system, while leaving the old insecure but easy to use system in place, help anyone migrate towards safer practices? Or reap any benefits for that matter?
I'm in two minds whether to pursue PowerShell any further or write it off as an squandered opportunity. If the DOS box is dead then PowerShell may soon be joining it in the same coffin.
Has anyone out there even heard of PowerShell let alone migrated to it?
I've heard of it but have never played with it.
No, but I usually get into DOS, but these days it is less and less.
Dennis, if you like playing around from the command line (cli) i think you need to download , burn and run an Ubuntu live Cd. Bash, the Bourne again Shell, is the cats pajamas, when it comes to file manipulation , diagnostics, and other such computer Ninaja magic. I use a terminal and command line regularly, and Bash is highly scriptable. And in many Linux environments, you can excecute a shell script with a simple double click.
p.s As I remember, wasn't monad set up to mimic a unix shell?
I do plan to explore the world of Linux but, sad person that I am, all I know is Windows. Sob!
You may be right about Monad and Unix. It was probably fine until MS decided to get paranoid about security and picked on a bad solution. There should be some system to explicitly authorise a script as "safe to run" which is not prey to command hijacking. For example, any editing or replacement of the script file invalidates its "licence to execute".
well.. if it were unix.. you could make an md5 sum of the file, and include an md5 sum check as part of the shell script. Get into the water Dennis.. try it from the live cd.. it doesnt require an install.. just that you make your cdrom/dvdrom bootable.
Dennis, if you are uncomfortable with Linux, you are not alone. Yet you are comfortable in DOS batch scripting, you will appreciate the fact that DOS scripting is merely the Unix shell's little retarded brother.
Ubuntu can see all your Windows directories, the reverse is not true. Midnight Commander will make child's play of exploring and moving files around, you may find your Ubuntu CD useful for that purpose alone.
I've had similar problems with all versions of Windows, and gave up entirely. Go to perl or Python for what you need done in batch files.