Solved

Create batch file for run the application and kill the application

Posted on 2013-07-02
8
1,221 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
 
LVL 2

Author Comment

by:fadyaz
Comment Utility
The File Name : saplogon.ini

The Path : %appdata%\sap\Common\
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 68

Expert Comment

by:Qlemo
Comment Utility
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
Comment Utility
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 68

Expert Comment

by:Qlemo
Comment Utility
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
Comment Utility
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

You may have already been in the need to update a whole folder stucture using a script. Robocopy does it well and even provides a list of non-updated files in a log (if asked to). Generally those files that were locked by a user or a process by the …
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.
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…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

762 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now