IBM RFT command line execution -datastore -playback parameter - command-line

I need to start my RFT scripts with a .bat script. I tried this with:
"%IBM_RATIONAL_RFT_INSTALL_DIR%\rational_ft.exe" -datastore "C:\project" -playback "test"
In the .bat file. With a test project in C:\project and a test script named test.java.
When I start the batch file, RFT opens a playback window and is looking for the script. But I always receive a error:
[Rational.Test.Ft.Application.ScriptPlaybackException: Could not get type for [test].
I found out that this must be a problem with the path of the test script.
But I still don't know what is going on, the path is correct and I tried everything without a positive result. RFT playback starts, but still cant find this script.
I hope anybody can help me. Thanks in advance.

Using the command you tried to start RFT I get the same error. I don't know what the rational_ft.exe is for, but it works when you don't call this but the java.exe with the class com.rational.test.ft.rational_ft:
"%IBM_RATIONAL_RFT_ECLIPSE_DIR%\jdk\jre\bin\java" -classpath "%IBM_RATIONAL_RFT_INSTALL_DIR%\rational_ft.jar" com.rational.test.ft.rational_ft -datastore C:\project -playback Test
See this IBM developerWorks article for more information.

Related

Don't succeed to execute .exe using powershell

I've looked into the forum for one hour now, and tried everything I've found here but still I don't manage to run my .exe using a powershell script.
Please forgive my ignorance, I'm very new with powershell..
Basically, my script is aimed to daily monitor files loaded.
For this, I need to list .txt files in my working directory, which I managed to do.
My issue is that when files arrive in my working folder, they have nonspeaking names that I can't figure out which business it's related to.
There is a RemaneFile1.exe executable that renames files according to some data codes inside my .txt files from something like "Inf320638.txt" to something like "lot_RUHPEG_296_320638" and that is exactly what .exe I would like to run using powershell (I didn't coded it, and I don't know how it works, just that when I manually run it it renames my files just fine).
I've tried those two command lines below, but when I look at my files, they are actually not renamed.
1. &".\INFOCENTRE\LOTS\RenameFile1.exe
=> When I check my file name it's still like "Inf320638.txt".
2. Start-Process ".\INFOCENTRE\LOTS\RenameFile1.exe" => A command prompt shows up for an instant, but when I check my file name it's like "Inf320638.txt".
Any help would be highly appreciated,
Brgs,
Thomas.
Try to run the executable with the following arguments:
Start-Process .\INFOCENTRE\LOTS\RenameFile1.exe -WorkingDirectory .\INFOCENTRE\LOTS -Wait
It might be, that the workingdirectory is what screws it up. The -wait switch lets powershell wait for the programm to finish, you could omit it.

how to run a cmd file from matlab

I am trying to run a cmd file from MATLAB but unable to execute it. Can anybody see nay problem in the below code?
this is what I have inside my cmd file:
echo on
>test.log 2>&1 (
C:/testProj/Make/makeit.cmd param1
)
And this is the MATLAB code:
Out = 'C:/testProj/test.cmd';
system(Out);
But this actually does not run the cmd file.
Well for somereason it would not run if i would give the complete path of the cmd in bat file. so I had a cd command to change the directory and then run. now it runs fine, Thanks all appreciate your help!
What about using eval, like this:
eval(['!test.cmd']);
I have succesfully used this to run .bat files (and this output of the .bat script showed in my matlab command line). I also found this dos command, but I am not sure if it works allright:
You can just type the following strings to get things down:
!(c:/testProj/test.cmd)
This is actually no different from
system('c:/testProj/test.cmd')
I think you should check if the path is wrong. As to your code in the cmd file, that's beyond my ability to help.

Word 2010 /m switch from batch file

I'm trying to execute a Word macro from a batch file. The documentation here indicates that this is accomplished using the /mMacroname switch.
However, when I do this, I receive an "Invalid switch - /mMacroname" error. It seems I'm doing something wrong, but I can't for the life of me figure out what it is.
The name of the macro is FormatStrikethrough. It opens/closes/etc. the file on its own. I am invoking it like so:
start "C:\Program Files (x86)\Microsoft Office\Office14\winword.exe" /mFormatStrikethrough
Dropping the start from the command will make it work.
I believe this is because your parameters were being passed to start rather than the winword executable. As for how to use start to launch a program with switches,
This answer seems to tell you how to do that.

Powershell Script doesn't work when starting it by double-clicking

I got some strange behaviour when executing a powershell script.
When I run my script using the ISE it works just fine.
When I open Powershell.exe and run my script it works just fine.
When I open cmd, and start my script using powershell.exe -noexit
./myscript.ps1, myscript works just fine.
When I double-click myscript however, powershell opens for some milliseconds, I see that it shows some error (red font) and the powershell window closes. I'm unable to track down the error causing this problem since the powershell windows closes to fast.
I even tried one single big try-catch block around my hole script, catching any [Exception] and writing it down to a log file. However: the log file is not generated (catch is not called).
How can I track that issue? What could possibly be causing the trouble?
Please note that my execution-policy is set to unrestricted.
Before trying the suggestion invoke this to see your current settings (if you want restore them later):
cmd /c FType Microsoft.PowerShellScript.1
Then invoke this (note that you will change how your scripts are invoked "from explorer" by this):
cmd /c #"
FType Microsoft.PowerShellScript.1=$PSHOME\powershell.exe -NoExit . "'%1'" %*
"#
Then double-click the script, it should not exit, -NoExit does the trick. See your error messages and solve the problems.
But now all your scripts invoked "from explorer" keep their console opened. You may then
remove -NoExit from the above command and run it again or restore your
original settings.
Some details and one good way to invoke scripts in PS v2 is here.
Unfortunately it is broken in PS v3 - submitted issue.
by default, for security reason when you double clic on a .ps1 file the action is : Edit file, not Run file .
to execute your script : right-click on it and choose run with powershell
I also wasn’t able to run a script by double clicking it although running it manually worked without a problem. I have found out that the problem was in the path. When I ran a script from a path that contained spaces, such as:
C:\Users\john doe\Documents\Sample.ps1
The scipt failed to run. Moving the script to:
C:\Scripts\Sample.ps1
Which has no spaces, solved the problem.
This is most likely an issue with your local Execution Policy.
By default, Powershell is configured to NOT run scripts that are unsigned (even local ones). If you've not signed your scripts, then changing your default double-click 'action' in Windows will have no effect - Powershell will open, read the execution policy, check the script's signature, and finding none, will abort with an error.
In Powershell:
Help about_execution_policies
gives you all the gory details, as well as ways to allow unsigned scripts to run (within reason - you'd probably not want to run remote ones, only ones you've saved onto the system).
EDIT: I see at the tail end of your question that you've set Execution Policy to 'unrestricted' which SHOULD allow the script to run. However, this might be useful info for others running into execution policy issues.
If you would catch the error you will most likely see this
The file cannot be loaded. The file is not
digitally signed. The script will not execute on the system. Please
see "Get-Help about_signing" for more details.
Because you are able to run it from the shell you started yourself, and not with the right mouse button click "Run With PowerShell", I bet you have x64 system. Manually you are starting the one version of PowerShell where execution policy is configured, while with the right click the other version of the PowerShell is started.
Try to start both version x64 and x86 version and check for security policies in each
Get-ExecutionPolicy
I was in exactly the same situation as described in the question : my script worked everywhere except when double-clicking.* When I double-clicked a powershell windows would open but then it will close after a second or so. My execution-policy is also set to unrestricted.
I tried the selected answer concerning FType Microsoft.PowerShellScript.1 but it didn't change anything.
The only solution I found was a work around: create a bat file which start the powershell.
Create a file, copy this and modify the path : powershell.exe -File "C:\Users\user\script\myscript.ps1"
Save it as a .bat
Double-click the bat
I also used .ahk to start my powershell with a shorcut and it didn't work when pointing directly to the powershell. I had to point to the .bat

Why I get other result for the `get-Help about_*` expression?

PowerShell 4.0
I read the Getting Started with PowerShell book. I try author's code but I get the other result... The screen of the book page (with my comment):
Read my comment on the screen, please. I get such results:
Why I get other results?
I have seen this same issue on several machines. Update-Help appears to execute successfully when run from a normal PowerShell window, but does not actually update many of the help files.
The solution is to run Update-Help from an elevated PowerShell window (Run as Administrator). Once this completes you should have all of the expected help files.
You may also have to specify the -UICulture parameter since Update-Help may not be utilizing your localization settings as seen in this post.
You can use this command to update help for your language:
Update-Help -UICulture (Get-Culture).Name
I found the reason of my problem...
I had launched Updated-Help with admin rights, of course, but I didn't restart the PowerShell session and got that unexpected result. Later I restarted PowerShell and saw that all works fine after restarting.
I didn't think that application restarting can be necessary at this case.