I want to run the following command from vb.net code. When I put it in process.start(" ")
it returns syntax error. Please advise
>E:\UnInstall\SQLServer\SQLServerExpress2008\SQLEXPR_x64_ENU.exe / SQ/SAPWD="testpwd123"/security=SQL/BROWSERSVCSTARTUPTYPE="Enabled"/TCPENABLED="1"/NPENABLED="0"/INDICATEPROGRESS="True"/INSTANCENAME="CBEInstance"/IACCEPTSQLSERVERLICENSETERMS="True"
You specify the file to run with Process.StartInfo.Filename, and the command line arguments with Process.StartInfo.Arguments.
Dim DosRun As Process = New Process
DosRun.StartInfo.FileName = "E:\UnInstall\SQLServer\SQLServerExpress2008\SQLEXPR_x64_ENU.exe"
DosRun.StartInfo.Arguments = String.Format("SQ/SAPWD=testpwd123/security=SQL/BROWSERSVCSTARTUPTYPE=Enabled/TCPENABLED=1/NPENABLED=0/INDICATEPROGRESS=True/INSTANCENAME=CBEInstance/IACCEPTSQLSERVERLICENSETERMS=True")
DosRun.Start()
Related
I am trying to launch spotfire application from VBA like following
Dim retval As Double
retval = Shell("Path\Spotfire.Dxp.exe", vbNormalFocus)
It works. It launches spotfire with the default servername,username and password
But I want to launch the application by giving the servername, username and password as parameters in the script. How do I do it?
I tried this
retval = Shell("Path\Spotfire.Dxp.exe -s http://spotfire.abcd.com -u ABCD\A7 -p ABC", vbNormalFocus)
But it launched the application with default parameters and gives error at the end "Unable to load file. Could not find the specified file : -s"
Please suggest the possible solution.
after checking our support db, I found a few references to / notation instead of -. so the following command should work:
c:\path\Spotfire.Dxp.exe /server:http://localhost:8080/ /username:user /password:pass
I am in the process of using the GenABEL package of R studio to convert the output of the Affymetrix Genotyping Console into a .tfam file. This is my code thus far:
rm(list = ls())
setwd("C:/U/Is/GD/Affymetrix")
library("GenABEL", lib.loc="C:/PROGRA~1/R/R-211~1.1-X/library")
read.table("Genotyping_results.txt", fill = TRUE)
convert.snp.affymetrix(dir = "C:/U/Is/GD/Affymetrix", map = "Genotyping_results.txt" , outfile ="Genotyping_results.tfam")
I am getting the following error:
"Error in system(command, intern = T) : 'ls' not found".
I have a limited understanding of programming and am finding it difficult to understand what is wrong or how I can solve it.
Any help would be greatly appreciated
You mentioned in the comments that you're using Windows. ls is not a command on your OS.
ls is a command in Linux and in R.
There are many ways to add that command to Windows, like Cygwin.
I need to call another sql file within an sql file using sql plus. This si the script i have so far and its not working. I have to code it in a unix vi file. I am new to this so would someone mind helping. thank you in advance.
call=`$LIVE_SQL/sqlfile2.sql`
if &call = 0 then
echo "ERROR: $LIVE_SQL/sqlfile2.sql file not found"
exit 1
fi
The command to call other SQL files from within SQLPLUS is : start (or #)
Getting feedback from the SQL script : SQLPLUS is not Bash. It is possible, but not really beginner stuff.
If I am using VBS to run some CMD commands, in this example ping, how could I write the command to a text file using VBS not DOS?
Set objCmdTest = WScript.CreateObject ("WScript.Shell")
Set Output = CreateObject("Scripting.FileSystemObject").OpenTextFile("C:\vbs\test.txt",8,true)
Output.WriteLine (objCmdTest.run ("ping failboat"))
Output.WriteLine (objCmdTest.run ("ping 8.8.8.8"))
So this is what I'm working with however what happens is; The script runs, the file is made, 2 command prompts open to run the pings and finally the text inside the file reads:
0
0
When I'd much prefer it to have the ping output.
FYI: Please don't offer suggestions that require me to use DOS for the writing, I'd like to see how VBS can do what I need for multiple reasons, thanks!
The instruction Output.WriteLine (objCmdTest.run ("ping failboat")) will write the return value of the Run method to the output file. If you want to append the command output to an output file you have to either redirect the output in the command:
objCmdTest.run "%COMSPEC% /c ping failboat >>C:\vbs\test.txt", 0, True
or use Exec instead of Run:
Set ping = objCmdTest.Exec("ping failboat")
Do While ping.Status = 0
WScript.Sleep 100
Loop
Output.WriteLine ping.StdOut.ReadAll
WScript.Shell's run method returns the process's exit code. In order to get access to an application's output, you need to use the exec method instead, and use the object that returns to get access to the process's standard output through its StdOut property.
I'm trying to run dos commands within vb.net program and capture output. I have the following code:
Dim CMDServer As Diagnostics.ProcessStartInfo
Dim CMDReply As Diagnostics.Process
CMDServer = New Diagnostics.ProcessStartInfo
CMDServer.FileName = "cmd.exe"
CMDServer.UseShellExecute = False
CMDServer.RedirectStandardOutput = True
CMDServer.CreateNoWindow = True
CMDServer.Arguments = "/C " + command
CMDReply = Process.Start(CMDServer)
Dim Reply As String = CMDReply.StandardOutput.ReadToEnd()
The code runs successfully if command is a valid dos command, and I get the output in Reply. If the command have no output ( eg: cd\ ) Reply is null. The problem is Reply is null even when the command is invalid. How to capture errors like "command is not recognized as an internal or external command...", "The system cannot find the path specified.." etc.. Please help me. Thanks..
Error messages come in a different output stream called StandardError. Just use a StreamReader or read it directly. Of course, the RedirectStandardError-Property of your ProcessStartInfo instance must be set to True.
Also, there is a ExitCode-Property which returns the ExitCode of the program after it has finished. 0 means 'successful'. Other error codes can be found in the MSDN Documentation. Here is a list of the common exit codes. For example, 2 means The system cannot find the file specified..
Errors are probably output on CMDReply.StandardError, not CMDReply.StandardOutput; try reading it, too. (And set CMDServer.RedirectStandardError to True as well.)