The Post-Predeploymet SharePoint does not recognize some terms - visual-studio

In SharePoint Post-deployment command Line I have: %windir%\sysnative\windowspowershell\v1.0\powershell -File "$(ProjectDir)Scripts\Post-Deployment\Script.Post-Deployment.ps1"
After running the deployment I received this error:
The term 'Get-SPBusinessDataCatalogMetadataObject' 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.
Does anybody has a solution?
Thank you!

Make sure you load the SharePoint snap-in, put this at the beginning of the script:
Add-PSSnapin Microsoft.SharePoint.PowerShell

Related

Running PowerShell script that runs exe as prebuild step in Visual Studio

In my Visual Studio Pre-built command line I have a newly created line
Powershell.exe -file "$(SolutionDir)Folder1\MyPowerShell.ps1"
And in this PowerShell script, it runs an .exe with some parameters
.\MyProgram.exe .\SomeFileArg.xml
When I run just the PowerShell script locally, either as ./MyPowerShell.ps1 or copy pasting the command into my PowerShell, it works.
But when I build my Visual Studio, this doesn't occur. I get the error .\MyProgram.exe.exe : The term '.\MyProgram.exe' is not recognized as the name of a cmdlet, 2> function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the 2> path is correct and try again. If I include the absolute path instead in my PowerShell script, then it works.
How can I achieve this with local paths? Or is there a variable so I don't have to hardcode the absolute path?
You can declare the local path (where the script file resides) as a variable in your code using:
$PSScriptRoot
https://riptutorial.com/powershell/example/27231/-psscriptroot

'gradle' is not recognized as an internal or external command, operable program or batch file

I've just installed Gradle, I tried putting in the Environment Variable so Windows will know where to look for Gradle. I believe I've done everything by the book. But when I type, Gradle -v, I get the message:
'gradle' is not recognized as an internal or external command, operable program or batch file.
So I made a video where you can experience what I am. I have no idea what is wrong???
My video of the problem
You have append path to the 'Gradle.exe' to the end of the %PATH% variable and restart computer.
If program name without full path is entered in windows shell, it try to look into the %PATH% variable and check all listed paths. If not successfull, than print message you got.

Running Jmeter gives 'findstr' is not recognized as an internal or external command

I am trying to open Jmeter by the batch file but it gives me a error like this:
'findstr' is not recognized as an internal or external command,
operable program or batch file.
Not able to find Java executable or version. Please check your Java installation.
errorlevel=2
Press any key to continue . . .
How can I fix this?
Right Click on My Computer, then click Properties, followed by Advanced System Settings > Environment Variables
Look for the Path System Variable
Add this path to the end, after a semicolon: C:\Windows\System32
Please Run Jmeter batch file as administrator
1.Browse to C:\Windows\System32 and search "findstr" file.
2. Copy and paste the "findstr" file in the bin folder of Jmeter (i.e) the path C:.....\apache-jmeter-3.3\apache-jmeter-3.3\bin
3. Then try to run the "jmeterw" or the "jmeter" bat file , it should work fine.

Current directory and parent directory seem broken

I have Windows 8.1 and I have a strange problem.
When I launch a Command Terminal, it seems that current directory and parent directory don't work when I try to use it to launch executable.
For example, considering the following folders :
C:/dirA/dirB/program.exe
C:/dirA/dirB/dirC
I put dirA/dirB in the PATH variable.
So, when I launch program.exe in Command Terminal, it works.
But, if I go in C:/ and launch the following command :
./dirA/dirB/program.exe
I got the following error :
'.' is not recognized as an internal or external command, operable
program or batch file.
Error is the same if I go on C:/dirA/dirB/dirC folder and launch the following command :
../program.exe
Error is :
'..' is not recognized as an internal or external command, operable
program or batch file.
So, I don't understand what is the problem and how to solve it. Someone have an idea and can help me ?
Thanks for your help.
Sylvain
If you want to use forward slashes (/) with paths in Windows Command Prompt you need to quote the whole path.
"./dirA/dirB/program.exe"
If you use backslashes (\) then you don't have to quote paths (unless your path contains spaces).

Where does windows cls.exe reside?

As we know windows CMD can clear the scren by cls.exe command. But I cannot find the command location.
Usually, I can use which to find the location of the command program file.
But for cls.exe, it does not work, and displays as:
which: no cls in c:\Windows\System32...
Could you guys help me how cmd works? I searched on the internet, only finding clues on how to use it. Not how itself works!
There is no cls.exe. 'cls' is an CMD.EXE internal built-in.
It's built-in command to cmd.exe and not a stand-alone program.
i.e. cls.exe does not exist:
C:\>"cls.exe"
'"cls.exe"' is not recognized as an internal or external command,
operable program or batch file.
C:\>"cls.com"
'"cls.com"' is not recognized as an internal or external command,
operable program or batch file.
C:\>"find.exe"
FIND: Parameter format not correct
The last one, find.exe, is just there to show what happens when it exists.

Resources