Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Create batch file for run the application and kill the application

Posted on 2013-07-02
8
Medium Priority
?
1,508 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:Meir Rivkin
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Author Comment

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

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

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 71

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 2000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
This is a fine trick which I've found useful many times, when you just don't want to accidentally run a batch script or the commands needs administrator rights.
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…
Suggested Courses

916 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