How to execute a batch file on different remote server using TFS Build
I have a build server and have 2 web servers. I am deploying using TFS Builds. Now, I have a requirement to execute a batch file which is kept on these 2 web servers. i.e. C:\MyBatch\CreateMe.bat
After my build is successful, I need to execute this batch from the build server.
Note, I cannot make any shared folder.
Hi Sameer,
Thanks for your post.
What’s the version of your TFS?
How do you deploy solution using TFS Build, run MSBuild deploy command or using Release Management?
That C:\MyBatch\CreateMe.bat file stay on your two web server machines separately?
If you want execute this bat file on your two web server machines separately using build process template, you need configure your web server machine as build agent, then add the InvokeProcess activity in build process template to run the bat file on build
agent machine after build, please refer to Hari’s answer reply in this post:
https://social.msdn.microsoft.com/Forums/vstudio/en-US/b8bcb19f-1296-441c-8356-e701b949445a/tfs-2010-how-to-execute-a-batch-file-after-build?forum=tfsbuild.
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.
Similar Messages
-
How do I copy a file to a remote server using runtime exec - plz Help!
Hi,
I am trying to copy a file to a remote server using a runtime exec command as follows:
Runtime.getRuntime().exec("scp "+getProperty(ListNewHandsetDetailsConstant.PROP_OUTPUT_PATH_JAR)+getProperty(ListNewHandsetDetailsConstant.PROP_OUTPUT_JAR_NAME)+".jar "+" "+getProperty(ListNewHandsetDetailsConstant.PROP_OUTPUT_PATH_TWO_USERNAME)+"@"+getProperty(ListNewHandsetDetailsConstant.PROP_OUTPUT_PATH_TWO_URL)+":"+getProperty(ListNewHandsetDetailsConstant.PROP_OUTPUT_PATH_TWO_JAR));
Problem is this statement does not execute, as when I try it directly on command line, it requests for a password. Any suggestions on how I can get rid of that? I think I might have to configure my ssh_config file, but when I did some "Googling", I found the configuration settings of a ssh2_config file. I tried those (changing it to Host-based Authentication), but it didn't recognise them. Please help, this is so urgent!
Regards,
SimzDon't use Runtime.exec (or ProcessBuilder) for this. Check out JSch at JCraft (or some other Java SSH API.
-
How to execute java batch file in JSP
Kindly give a solution. I want execute a batch file which gives a preview window ,. I want call that batch file in my jsp, .I am using Tomcat 5.5, I have tried that using a Process object and Runtime.getRuntime().exec(path) , where path is location of my batch file. As a java class i could execute the batch file, but when i import the method in JSP nothing is happening (even no jsp error).
Is it possible to execute the batch file in JSP?
Can any one help me?itsdhanasaraa wrote:
But as this a web application ... By using Runtime i'm getting some probs ..
Let me guess, you want your web application to run a program on the client and to your surprise that's not working?
Ain't gonna happen.
its taking more time to execute .... that's y is there any other option to execute .exe file other than Runtime.getRuntime().exec("filename");Write proper English and you may be taken more seriously.
1) it's not "taking more time to execute", whatever that's supposed to mean.
2) there's no other way to execute something. Not that you should every use even that way anyway
3) whenever you start thinking of executing external programs from Java, start thinking of not using Java in the first place. -
Hi All ,
How to execute a .exe file in Jsp without using a process ??? ...
Is it Possiable ????itsdhanasaraa wrote:
But as this a web application ... By using Runtime i'm getting some probs ..
Let me guess, you want your web application to run a program on the client and to your surprise that's not working?
Ain't gonna happen.
its taking more time to execute .... that's y is there any other option to execute .exe file other than Runtime.getRuntime().exec("filename");Write proper English and you may be taken more seriously.
1) it's not "taking more time to execute", whatever that's supposed to mean.
2) there's no other way to execute something. Not that you should every use even that way anyway
3) whenever you start thinking of executing external programs from Java, start thinking of not using Java in the first place. -
How to execute a batch file using javascript
Hi,
I dont know java. i have a batch file to do my task. Im designing the front end with HTML.Can anyone tell the command to execute batchfile using javascript
Message was edited by:
viswanath_javaJava and not JavaScript are not the same thing or even close to the same thing. You appear to be in way over your head. It might be a good time to fess up to your employer that you are underqualified.
Apart from the JavaScript faux pas your question is also lacking because
- you don't identify what this batch file is or does or needs to execute in
- it is very difficult to understand how the front end for this will be HTML
It seems you may one day want something like a Servlet. But you are long way from implementing this solution. -
Execute a batch file on a remote PC
Hello,
I have a powershell script that I would like to exceute several batch commands on a remote computer. I first need the script to change to the network drive on that remote computer then execute a batch command that I write into the script is that
possible?
GI did try it and no results were giving and the jvm services on the remote machine was not stopped. Here is what im trying to do based on your suggestions.
$process
=
[WMICLASS]"\\severgoeshere\ROOT\CIMV2:win32_process"
$result
=
$process.Create("e:\stopserver.bat
JVMdfs -user <myusername> -password <mypassword> ") -
How to upload a current file to the remote server in Dreamweaver?
I am trying to transfer an html file from FrontPage to the server via Dreamweaver, but it absolutely refuses to upload. Help!
Nobody can know anything. You are not providing any system information, what version of DW you use, what the remote server actually is. and since this is a DW question, ask in their forum with the proper information included.
Mylenium -
How to invoke a Batch file in a remote system from JSP
Hi,
Please help me. Its urgent. Here is the problem.
I have Tomcat Server installed in machine A and I have .bat or a perl script file in an another system called Machine B in the same LAN. I want to invoke the .bat file or shell script in the machine B from my JSP running in Tomcat in Machine A. Help is appreciated.The first thing to be done is that the bat / perl script file should be shared at the remote machine. Means that could be accessed by giving any url.
After that read that file in jsp by opening file input stream for that file and create/save the file by same name at the machine from where the jsp is running by creating file output stream.
Once the file gets created at the machine, execute that by Runtime.exec method. Don't forget to close the streams just after the reading/writting. -
How to execute a .reg file in a task sequence using MDT 2013
Hi,
Im trying to add a couple of desktop icons to my custom images during deployment using MDT 2013. I have a .reg file with all commands inside it but I am struggling to get these to work. the .reg file is located on my deployment server and is in a shared
folder which everyone has full read\write access to, I was wondering if someone could help?
The commands inside the .reg file are:
reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu /v {20D04FE0-3AEA-1069-A2D8-08002B30309D} /t REG_DWORD /d 0 /f
reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel /v {20D04FE0-3AEA-1069-A2D8-08002B30309D} /t REG_DWORD /d 0 /f
reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu /v {59031a47-3f72-44a7-89c5-5595fe6b30ee} /t REG_DWORD /d 0 /f
reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel /v {59031a47-3f72-44a7-89c5-5595fe6b30ee} /t REG_DWORD /d 0 /f
ThanksThat's not a *.reg file. that's a set of commands used in a *.cmd file.
Keith Garner - Principal Consultant [owner] -
http://DeploymentLive.com -
DSC powershell xwindowsprocess to execute batch file under different user account
DSC powershell run under "NT AUTHORITY\SYSTEM".
I am trying to execute a batch file under different user account using xwindowsprocess in DSC resource kit.
I created a custom dsc resource with 3 parameters namely Exepath, Arguments, Credential.
I received those parameter values in settargetresource method.
CallPInvoke
[Source.NativeMethods]::CreateProcessAsUser(("$ExePath "+$Arguments), $Credential.GetNetworkCredential().Domain, $Credential.GetNetworkCredential().UserName, $Credential.GetNetworkCredential().Password)
I tested it by invoking a batch file and writing username under which it executes to a text file.
After executing, the output text file still contains the "Systemname$".Configuration Sample_xService_ServiceWithCredential
param
[string[]]
$nodeName = 'localhost',
[System.String]
$Name,
[System.String]
[ValidateSet("Automatic", "Manual", "Disabled")]
$StartupType="Automatic",
[System.String]
[ValidateSet("LocalSystem", "LocalService", "NetworkService")]
$BuiltInAccount="LocalSystem",
[System.Management.Automation.PSCredential]
$Credential,
[System.String]
[ValidateSet("Running", "Stopped")]
$State="Running",
[System.String]
[ValidateSet("Present", "Absent")]
$Ensure="Present",
[System.String]
$Path,
[System.String]
$DisplayName,
[System.String]
$Description,
[System.String[]]
$Dependencies
Import-DscResource -Name MSFT_xServiceResource -ModuleName xPSDesiredStateConfiguration
Node $nodeName
xService service
Name = $Name
DisplayName = $DisplayName
Ensure = $Ensure
Path = $Path
StartupType = $StartupType
Credential = $credential
$Config = @{
Allnodes = @(
Nodename = "localhost"
PSDSCAllowPlainTextPassword = $true
#Sample Scenarios
$credential = Get-Credential
Sample_xService_ServiceWithCredential -ConfigurationData $Config -Name "Sample Service" -DisplayName "Sample Display Name" -Ensure "Present" -Path "C:\DSC\TestService.exe" -StartupType Automatic -Credential $credential
¯\_(ツ)_/¯ -
how do I send a file to a remote server?
I attached my code so you can see what is missing.
the purpose of it is to send a server all the files in a directory + the name of directory + how many files there are
URL url=null;
try {
url= new URL("www.<server's address>");
}catch (MalformedURLException e) {
try {
// Construct data
File[] picFiles= path.listFiles(new pictureFileFilter());
int numOfFiles= picFiles.length;
String setName= path.getName();
String data= ("setName= " + setName);
data += ("&" + "numOfFiles= " + numOfFiles);
String[] allFiles= new String[numOfFiles];
for (int i=0; i<numOfFiles; i++) {
FileInputStream FIS= new FileInputStream(path);
//WHAT TO DO HERE?!?!?
data += ("&"+"allFiles="+allFiles);
// Send data
URLConnection conn = url.openConnection();
conn.setDoOutput(true);
conn.setDoInput(true);
OutputStreamWriter wr = new
OutputStreamWriterconn.getOutputStream());
wr.write(data);
wr.flush();
// Get the response
BufferedReader rd = new BufferedReader(new
InputStreamReader(conn.getInputStream()));
String line;
while ((line = rd.readLine()) != null) {
//what to do with response (this part is OK)
new GoodBadMassage(line);
wr.close();
rd.close();
} catch (Exception e) {
}~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
another thing-
is the line --- conn.setRequestProperty("content-type","binary/data");
replace the need in ---
String data= ("setName= " + setName);
OutputStreamWriter wr = new utputStreamWriter..
wr.write(data);
I'm not sure what does is do (setRequestProperty)
THANKS!!You start out by trying to use a malformed URL (it doesn't start with a protocol). This suggests to me that you haven't thought about the natural question: what kind of server software is running on that server that will accept files?
-
How to execute a .sql file from a batch file
Hi all
I've to take backup of a database weekly twice on every wednesday & Friday @ 5pm IST. I've written a hot backup script, which works every well.
now i want to automate the script. ie i want this script to run on wednesday & friday @ 5pm without any human interfearance ie with out actually any1 executing this script.
i created a batch file prod.bak with the following lines
@echo off
set oracle_sid=testdb
set oracle_home=d:\oracle\ora92
sqlplus /nolog
connect sys as sysdba/oracletest@testdb
this batch file when eexecuted connects me to sql prompt.
Now i want to execute my backup script bkp.sql automatically when it is connected to sql prompt.
(i tried with these lines in the above batch file...
call bkp.sql---it just opens the bkp.sql file in notepad & displays the script
start bkp.sql---same as call
connect / as sysdba/pwd@[email protected] --- does not work simply remains a the sql prompt.
At 17:00 /Every:w,f "d:\bkp.sql"---does not work simply remains at the sql promt.)
Can any1 let me know what should i write in the batch file that will execute the bkp.sql file automatically after it gets connected to sql prompt. M using oracle 9i.
I'll manage he time through windows utility of scheduling task.. Let me know how to execute the .sql file from a batch file.
Thanks
TriptiTry
sqlplus "sys/oracletest as sysdba" @bpk.sql
Working locally, and having set the ORACLE_SID, you don't need to specify the SqlNet alias (@testdb).
Remember to put an exit at the end of the bpk.sql script. -
General question: How to execute a batch input using different user name?
Hi everyone,
I would be very grateful if someone could tell me how to execute a batch input from source code using a differente username so the batch input is executed with different permissions.
For example, I log on with:
Username: A
, but I'd like to execute a batch input using the rights and permissions of user B.
Thanks in advance and best regards.
Ben.If you are calling the BDC in a program, create a job to run the program and specify the user you want each program to run under.
-
Executing a batch file (.bat) on a different PC
Hi,
Is it possible to execute a batch file on a different pc.
Look at the following piece of code.
import java.io.*;
public class StartRemoteCmd {
public static void main(String[] args) throws IOException
System.out.println("Starting remote Command");
Process p = Runtime.getRuntime().exec("\\\\Itop001\\Tomcat\\commons-net-1.0.0\\setclasspath.bat");
if (p==null){
System.out.println("Process is null");
System.exit(1);
System.out.println("Started remote Command");
The machine ITOP001 has this setclasspath.bat...which sets classpath and has a java CustPgm.
I want to start this CustPgm program on ITOp001 from my machine.
Is it possible..? Am I doing some mistake in the code..pls suggest.
Thanks guysCan't really add much to the online help:
The AT command schedules commands and programs to run on a computer at
a specified time and date. The Schedule service must be running to use
the AT command.
AT [\\computername] [ [id] [/DELETE] | /DELETE [/YES]]
AT [\\computername] time [/INTERACTIVE]
[ /EVERY:date[,...] | /NEXT:date[,...]] "command"
\\computername Specifies a remote computer. Commands are scheduled on the
local computer if this parameter is omitted.
id Is an identification number assigned to a scheduled
command.
/delete Cancels a scheduled command. If id is omitted, all the
scheduled commands on the computer are canceled.
/yes Used with cancel all jobs command when no further
confirmation is desired.
time Specifies the time when command is to run.
/interactive Allows the job to interact with the desktop of the user
who is logged on at the time the job runs.
/every:date[,...] Runs the command on each specified day(s) of the week or
month. If date is omitted, the current day of the month
is assumed.
/next:date[,...] Runs the specified command on the next occurrence of the
day (for example, next Thursday). If date is omitted, the
current day of the month is assumed.
"command" Is the Windows NT command, or batch program to be run. -
Hi,
I need help in writing a method that execute a batch file which is in a different directory from my java application and show the result(after executing the batch file) in the java application. Can anyone tell me how to do that?
Thanks,
KhimHi,
Below are the codes in my application. Using these codes, the batch file can execute but I cannot get the output of the result from the batch file. (if I run the batch file from cmd, it shows: "Error: 0 : Cannot authenicate the information after all the attempts")
String cmd = new String();
Runtime rt = Runtime.getRuntime();
System.out.println("Executing VocaliD check..");
cmd="C:\\JNI\\Elva\\debug\\plug.bat";
Runtime rn = Runtime.getRuntime();
Process pc1 = rn.exec(cmd);
String result=new String(pc1.getInputStream().toString ());
System.out.println(result);
The result I got is below:
Executing VocaliD check..
java.io.BufferedInputStream@3179c3
Thanks,
Khim
Maybe you are looking for
-
ICal Week view, Date is not aligned with the Time(schedule) of each date
Well, just like it says over there (`` ). I've recently been to China for a business trip, and I suppose the different time zone may have had something to do with the problem. Now I'm back home, changed the time zone back to normal, still the iCal sh
-
HI all, We have different infoobjects and whose bex properties defined differently for description. some are set to show short description and some are long description. so here is the question Short text such as a year should be centered when disp
-
I cleaned my screen with methid galss and surface cleaner and now the color is off on my screen...What can I do?
-
Short Message Transfer Rejected
Why does my Blackberry not let me send messages to my dad? I can recieve , messages from him and phone him, but whenever I send a message to him, it comes up with a red 'X' and 'Short message transfer rejected'. Why is this happening and how can I f
-
Hi All, i craeted a array of Document... I used it as .... while(DivideRows>0) dom[Domcnt]= initiatexml.createDocument(dom); DivideRows = DivideRows - 5; Domcnt++; ......On this i dont get any error But for this snippet i get an error String[] packag