Solved

Create batch file for run the application and kill the application

Posted on 2013-07-02
8
1,302 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
[X]
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
  • 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
How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

 
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

When you receive another warning that your shared drive is almost full and you have asked your users to clean out old files again and again, here is a single command that may help. This command will place all the files that have not been used rec…
Utilizing an array to gracefully append to a list of EmailAddresses
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…

740 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