Windows PowerShell cannot recognize sqlite3 - powershell

I have installed SQLite3 on my computer in G:\SQLite3\sqlite3.exe
However, when I type "sqlite3" (no quotes) to PowerShell, it gives me the following error:
sqlite3 : The term 'sqlite3' is not recognized as the name of a cmdlet, functio
n, script file, or operable program. Check the spelling of the name, or if a pa
th was included, verify that the path is correct and try again.
At line:1 char:1
+ sqlite3
+ ~~~~~~~
+ CategoryInfo : ObjectNotFound: (sqlite3:String) [], CommandNotF
oundException
+ FullyQualifiedErrorId : CommandNotFoundException
My Environmental Path includes G:\SQLite3, so when I run sqlite3 in command prompt (cmd.exe), it runs just fine. I prefer PowerShell though, so I would be glad, if someone could point me in the right direction how to make it accept this command. If that matters, I use Windows 8.

Most likely the directory G:\SQLite3 is not in your PATH environment variable, so PowerShell doesn't know where to look for the executable. Either run the executable with its full path, or add the directory to the $env:PATH:
$env:PATH += ';G:\SQLite3'
& sqlite3.exe

Related

PowerShell The term 'which' is not recognized as cmdlet function script file or operable program

I am using PowerShell and want to do a which command, however I am seeing this error:
which : The term 'which' is not recognized as the name of a cmdlet, function,
script file, or operable program. Check the spelling of the name, or if a path
was included, verify that the path is correct and try again.
At line:1 char:1
+ which xxxxxx
+ ~~~~~
+ CategoryInfo : ObjectNotFound: (which:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
I have done a search on Google and there is no specific answer to my question. Has anyone encountered the same error before and how can I fix it?
Putting an answer together from the comments:
which is a standard command of Linux, but is not normally present on Windows.
The equivalent command is Get-Command, or if you have it, you can run where.exe.

How to run IoTCorePShell.cmd

I try to port Prolific USB to COM converter for solve my other problem: List UART -> COM converter in Windows Device Portal
I found this manual: https://learn.microsoft.com/en-us/windows/iot-core/learn-about-hardware/peripheraldrivers and copied all necessary files to separate folder:
oem6.inf
ser2pl64.sys
serenum.sys
I installed:
Windows 10 IoT Core Packages
Windows Assessment and Deployment Kit including Windows PE add-on
Now I try to launch IoTCorePShell.cmd for run New-IoTInf2Cab as mentioned in the manual.
I tried both cmd and Power Shell, both with administrator rights and without.
In Power Shell I get:
PS C:\Users\olga\Desktop\COMDriver> New-IoTInf2Cab
New-IoTInf2Cab : The term 'New-IoTInf2Cab' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ New-IoTInf2Cab
+ ~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (New-IoTInf2Cab:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
How can I run New-IoTInf2Cab?
OK, it was necessary to clone the repository.
The IoTCorePShell.cmd stay in the root.
https://github.com/ms-iot/iot-adk-addonkit

The term 'cpdf' is not recognized as the name of a cmdlet, function, script file, or operable program

I have downloaded CPDF because I have to batch work on a large number on PDFs.
The executable is on my Desktop: C:\Users\admin\Desktop\cpdf.exe
I am running PowerShell ISE on Windows 7 as Administrator. I have set Set-ExecutionPolicy Unrestricted.
My prompt is at the desktop location: PS C:\Users\ftsadmin\Desktop> but if I try to run cpdf: PS C:\Users\ftsadmin\Desktop> cpdf or as PS C:\Users\ftsadmin\Desktop> cpdf.exe, I get the following error:
The term 'cpdf.exe' is not recognized as the name of a cmdlet, function, script
file, or operable program. Check the spelling of the name, or if a path was
included, verify that the path is correct and try again.
At line:1 char:9
+ cpdf.exe <<<<
+ CategoryInfo : ObjectNotFound: (cpdf.exe:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
I don't understand. When I am doing exactly the same in my Windows XP VM, it works (but I prefer Windows 7+ because of the PowerShell ISE).
Any ideas what I'm missing?
Unlike CMD PowerShell does not automatically include the current directory in the search path (it behaves like Unix shells in this respect). To run a program or script from the current directory you need to use the relative or absolute path:
.\cpdf.exe
C:\Users\ftsadmin\Desktop\cpdf.exe
The execution policy has nothing to do with this, as it governs only the execution of PowerShell scripts, not of external commands.

Open program files directory using powershell and env variable

My goal is to create a PowerShell script, which would open specific directories in Windows Explorer.
Some of the directories could be referenced through the environment-variables.
However I got a problem with the following command
ii %programfiles(x86)%
Execution returns the following error:
The term 'x86\' is not recognized as the name of a cmdlet, function, script
file, or operable program. Check the spelling of the name, or if a path was
included, verify that the path is correct and try again.
At line:1 char:23
+ ii %programfiles\(x86\ <<<< )%
+ CategoryInfo : ObjectNotFound: (x86\:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Can you kindly explain to me, what I'm doing incorrectly here?
%variable% is batch notation. In PowerShell you have to use $env: to access environment variables.
Invoke-Item ${env:ProgramFiles(x86)}
The curly brackets are required, because without them the parentheses wouldn't be recognized as part of the variable name.

How do I get "hello world" script to run from the command line in powershell?

I can not get pass this error message.
Thanks
The term 'power-date.ps1' is not recognized as the name of a cmdlet, function, script file
, or operable program. Check the spelling of the name, or if a path was included, verify t
hat the path is correct and try again.
At line:1 char:15
+ power-date.ps1 <<<<
+ CategoryInfo : ObjectNotFound: (power-date.ps1:String) [], CommandNotFound
Exception
+ FullyQualifiedErrorId : CommandNotFoundException
PowerShell will not run scripts in the current directory unless you prefix them with .\ e.g.:
.\power-date.ps1
This is a security feature that prevents someone from dropping a script called dir or ls into a directory the hacker can access and that the user is often in. The hacker's intention being that when the user executes dir, the fake dir.ps1 wwould be invoked unknownst to the user. This security feature prevents this sort of attack. If the user wants to invoke the script dir.ps1, they have to explicitly reference it by path e.g. .\dir.ps1