Last updated on January 5th, 2011
Last time we learned how you can pre-determine where your script is executed by using meta-comments inside your code.
While this third installment also deals with execution in either 32 or 64 bit environments, the main gap being addressed today is between script development and working in a shell.
For us developer types, the use of an IDE is pretty clear cut: We write code and we want as little dependency on our development machine as possible.
Administrators once again live in two worlds: Of course you develop scripts that will run on other machines and, just as us, should have as little dependency on your local settings as possible. Additionally you also do interactive work in a shell, running scripts, code snippets or typed commands, you name it.
In PrimalScript 2009 you could already embed a shell of your choosing in PrimalScript, and with some knowledge you could even run a 64 bit shell inside PrimalScript’s 32 bit process.
With PrimalScript 2011 you can run any number of shells and easily switch between them. CMD.exe, PowerShell, Bash, 32 bit, 64 bit, doesn’t matter. AND, unlike in the 2009 version, switching between shells does not reset the shell. So you can work in 32 bit PowerShell while a lengthy process runs in the 64 bit shell.
Running a script in your current shell is as simple as pressing the new “Run in Shell” toolbar button (Ctrl+Alt+F5)
Needless to say you can still just as easily drag and drop code from any script or a snippet onto a shell window and execute them.
If you remember the last article, I was teasing you with a meta-comment
# %ForceShell%=PowerShell 64 bit
So if you hit your regular Ctrl+F5 or Run Script button, the shell called PowerShell 64 will open and your script will execute there.
Oh and because so many emails came in and asked about VBScript…. All of this is also available to VBScript, platform selection, met-comments, run in shell, all of it.