How to run shells like SQLite from PowerShell ISE? - sqlite

I want to do some things with sqlite3.exe, the sqlite3 command line shell. After navigating to the directory in PowerShell ISE, I run the program with .\sqlite3.exe and get the expected output from SQLite:
___________________________________________________________
PS [path]\SQLite shell> .\sqlite3.exe
SQLite version 3.7.14 2012-09-03 15:42:36
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
However, if I try typing .help after this, or any other command for that matter, nothing happens and the bottom taskbar says "Already running a command. Please wait.". Of course, there is nothing to wait for, because clearly sqlite3.exe is waiting for input from me.
I cannot get PowerShell ISE to respond to any further commands after this point unless I quit SQLite with Ctrl+Break.
What is wrong?

The problem is Powershell ISE isn't like the normal Powershell console. Powershell ISE is a host built on WPF which you'll find certain legacy exe commands do not work correctly in ISE. These are normally interactive exe commands and not just sqlite3.exe. For example I've had issues with logparser.exe in ISE also.
Try running it in poweshell.exe

Related

how can i use "|find" in robot frame work

I want to know the status of the virtual machine
In Command Prompt by executing the below command
C:\Program Files\Oracle\VirtualBox>vboxmanage showvminfo Linux |find "State:"
I got output as
=>State: running (since 2020-09-30T06:00:01.824000000)
the same thing when I tried in robot framework(RIDE)
#${result}= Run process C:\\Program Files\\Oracle\\VirtualBox\\VBoxManage showvminfo Linux |find "State:"
I am getting error as -
Syntax error: Invalid parameter '|find'
Can someone help how to use |find in robot framework.
Piping eg, using | character is shell feature. If you want to run shell commands or using features from it, you need to tell Run Process to run it inside a shell by adding shell=yes to your Run Process keyword.
This is documented in https://robotframework.org/robotframework/latest/libraries/Process.html#Process%20configuration and a section below it called Running processes in shell

db2 command not found in unix

I am trying to execute a simple db2 command in Linux command prompt. but Linux command prompt is not recognizing the command it is giving - bash db2 command not found. but db2 is installed in the Linux machine.
command I am trying to execute from Linux command line processor is db2 "create database smaple"
Error I am getting is below "If db2 in not a typo you can run the following command to lookup the package that contains the binary" command-not-found db2 -bash: db2: command not found"
Is this because of environment variable problem ?? or there is only one instance of db2 ie db2inst1 is running in the machine.my user name in appsusr and db2 instance name is db2inst1 are different is this causing problem?? and I am not having super user access.Is this is causing any problem?? do I need super user access is required ??
Just type, echo $PATH in your command prompt , where you can see all the exported paths in your system.
If the db2 path is not found in your environment variable list, then do the following.
export PATH=$PATH:/opt/IBM/db2/V10.1/bin
and then press enter.
I hope this will resolve your issue.
On Linux and UNIX DB2 platforms, the proper way to set your environment variables to run DB2 commands is to source the sqllib/db2profile script belonging to the local DB2 instance owner. That will set not only your PATH but also other important variables that DB2 requires.
In your case, the instance is owned by the db2inst1 user, so your login startup file or batch script should run this command:
. ~db2inst1/sqllib/db2profile
The leading dot is necessary to set the variables in your current shell process, not the sub-process that quickly vanishes after db2profile finishes.
It's more than likely that, if DB2 is installed, it's simply not in your path.
Your path should contain something like:
/opt/IBM/db2/V10.1/bin
which is where the executables live (depending on which version you're running).
Changing your path will probably entail changes to one of the startup files, such as .bashrc or .bash_profile.

Sqlite3 will not execute in Cygwin

I just downloaded the Sqlite3 command line shell for windows (http://www.sqlite.org/download.html). However when I try to run the executable in Cygwin it does not load and just hangs.
The Sqlite3 shell itself works as if I browse to it in Windows explorer it runs or if I open it in cmd it runs. How do I get it to work with Cygwin?
Cygwin currently doesn't work well with interactive native programs. It has to do with the way the Cygwin terminal code works, in order to provide expected POSIX semantics to Cygwin programs.
Therefore, your best bet is to use Cygwin's own SQLite package.
If you absolutely must use the native sqlite3.exe, you'll have use cmd.exe to run sqlite3.

netsh mbn show interfaces results in command not found on Win7 64Bit

I'm trying to run "netsh mbn show interfaces" from a .bat or .jar file on a Windows 7 64bit system but every time I run my file, it results in "The following command was not found mbn show interfaces".
When I run that same command in a cmd.exe prompt, the result is correct and as expected.
When we run /? we see "mbn" in available commands. When we output that same result from a .bat or .jar, we don't see that "mbn" command in the available commands for netsh.
Anybody know what's happening?
We know there are 2 netsh.exe files, one in sys32 and one in syswow64.
All help is appreciated.
we solved the problem:
When running the command "netsh mbn show interface" was running the cmd as a 64bit operation.
When running the command from an application - that is 32bit - the cmd is run as a 32bit operation. And the mbn-context is not available in 32bit.
In a windows 64bit os, a behind the scenes function exists: file system redirection.
Meaning: a 64bit process will call the equivalent 32bit process.
The workaround is that you use a csharp script or something else where you can override the file system redirection:
IntPtr ptr = IntPtr.Zero;
Wow64DisableWow64FsRedirection(ref ptr);
// -- your proces information here --
Wow64RevertWow64FsRedirection(ptr);
//always revert the operation.
and that solved it!

Can you read pragma statements on command line startup in SQLite

I use the command line sqlite3 executable to check queries I make from my code.
Is there a way to read in pragma statements or other session setup (".mode csv" for example) when the executable starts up?
I know I can do a ".read " once I'm in, but that's tedious.
Put a .sqliterc file in your home directory with
the commands you want executed each time you start
the sqlite3 command line tool.
Unix and Linux use ~/.sqliterc; Windows tries to find the
location of .sqliterc using the environment variables
USERPROFILE HOME HOMEDRIVE and HOMEPATH.

Resources