Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Create batch file for run the application and kill the application

Posted on 2013-07-02
8
1,282 Views
Last Modified: 2013-07-03
Hello,

we deployed SAP GUI on all our PCs but we need to copy the ini configuration file to specific location but the problem this location did not exist until the SAP run for the first time after that you can find the path and copy the file.

so i want to create a script file to run the application and close it or kill i the copy the ini file to to the specific location (the file should be replaced with the new one)

Can we do it ?

Regards,
0
Comment
Question by:fadyaz
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 42

Expert Comment

by:sedgwick
ID: 39292511
hello again.

do u want the script to wait till the installation is over and then copy the .ini file to the asp gui location folder?
0
 
LVL 2

Author Comment

by:fadyaz
ID: 39292650
yes. but the path to be exist the application need to run first then we can copy the file on this location.
0
 
LVL 17

Expert Comment

by:Lior Karasenti
ID: 39292713
What is the location to which you need to copy the INI to? Please post the complete path and the name of the INI file.
0
MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

 
LVL 2

Author Comment

by:fadyaz
ID: 39292918
The File Name : saplogon.ini

The Path : %appdata%\sap\Common\
0
 
LVL 69

Expert Comment

by:Qlemo
ID: 39292937
I suppose it is sufficient to create that folder, copy the SAPLogon.INI, and then start the SAP Logon.
@echo off
xcopy \\server\share\saplogon.ini "%appdata%\sap\Common\"

Open in new window

0
 
LVL 2

Author Comment

by:fadyaz
ID: 39293046
I created the below script to install the SAP and then to run the application and kill it then start copying the file . can you check it and help me to the modification.

but i need to the last three steps run only when the installation finish
@echo off

\\Server\50118243_6\NW_7.0_Presentation_\PRES1\GUI\WINDOWS\WIN32\Setup\NwSapSetup.exe /Silent /Product="SAPGUI710"

start /d "C:\Program Files (x86)\SAP\FrontEnd\SAPgui\" saplogon.exe
taskkill /f /im saplogon.exe
copy "\\sharefolder\SAP Batch\saplogon.ini" "%appdata%\sap\Common\"

@echo off

Open in new window

0
 
LVL 69

Expert Comment

by:Qlemo
ID: 39293099
You can try to insert
if errorlevel 1 exit /b

Open in new window

before line 5. The installer needs to return an error code for this to work.

Are you sure you can't just copy the ini, then try to install?
0
 
LVL 17

Accepted Solution

by:
Lior Karasenti earned 500 total points
ID: 39293228
The following code should work:
@echo off

\\Server\50118243_6\NW_7.0_Presentation_\PRES1\GUI\WINDOWS\WIN32\Setup\NwSapSetup.exe /Silent /Product="SAPGUI710"

md "%appdata%\sap\Common"
copy "\\sharefolder\SAP Batch\saplogon.ini" "%appdata%\sap\Common\"

start /d "C:\Program Files (x86)\SAP\FrontEnd\SAPgui\" saplogon.exe

Open in new window

0

Featured Post

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

838 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question