Saved Bookmarks
| 1. |
Solve : Help setting a variable in a Batch that is copied to a text file? |
|
Answer» Hello, Hello, 1.) Can you show us some of your code, so we can get a feel for what you are trying to do? 2.) In the meantime, what happens if you do something like this in your batch file? : ECHO %variable_name_here% > filename.txt or echo %variable_name_here% >> filename.txt Is this a homework assignment? And what operating system are you using?Not A homework assignment I just would like some help. Let give more details. Hardware and operating system: AMD Opteron 848 server running Windows Server 2003 SP1. I need to set a variable in the batch so the users can change them in one place each month. The essmsh COMMAND starts the Essbase interface in interactive mode. The variables I'm trying to set need to update in CopySPS.txt prior to the essmsh line running. In CopySPS.txt they are set again so that Essbase can save them as user defined variables which are then used in calculation scripts. ***************BATCH SCRIPT************************************** Set clearscen = Actual\\Forecast_2007 Set ClearStart = May essmsh E:\Hyperion\HypData\EssAdmin\SPS\CopySPS.txt ***************************************************************** ***************************COpySPS.txt****************************** /* pdate the specified variable VALUE. !!(SV_OptA_1, SV_OptA_2, SV_OptA_3, No Change)!!*/ alter database GL.GL set variable "clearscen" "Actual\\Forecast_2007"; alter database GL.GL set variable "clearstart" "May"; ******************************************************************** So you want to be able to save CLEARSCEN and SLEARSTART to a file and be able to change them in the batch file? You can save them to a file like: Code: [Select]Set clearscen=Actual\\Forecast_2007 Set ClearStart=May echo %clearscen% > E:\clearscen echo %ClearStart% > E:\ClearStart You read them in like: Code: [Select]set /p clearscen=<E:\clearscen set /p ClearStart=<E:\ClearStart echo clearscen=%clearscen% echo ClearStart=%ClearStart% Obviously, you don't want the static SET in your batch file if you are reading the variables from a file, you just need something to set them with the first time. Is that what you were looking for? Hey GuruGary, Correct I need to be able to set and change variable in the batch script and have variable change in the text file. The text file actually contains the instructions that Essbase will use. So in sequence of events it should be the following. 1 Set variable in batch and save batch 2 Kick of batch 3 Batch sends variable to a specific place in the text file 4 Batch calls text file using essmsh command which reads text file with Essbase command containing changed statement. 5 Essbase executes instructions in text file ThanksQuote from: lostdude on May 11, 2007, 12:10:09 PM 1 Set variable in batch and save batchSet what variable, and where do you get the information on what the variable is, and what the value is? And what do you mean "save batch"? The batch file should be static. Please explain. |
|