Set Variable In Batch File For Loop

txt @REM into file01. The method I will be using is very simple, but unfortunately it is not fool proof. H ow do I run shell loop over set of files stored in a current directory or specified directory? You can use for loop easily over a set of shell file under bash or any other UNIX shell using wild card character. I don't work with CMD at all, but after doing some research was able to generate the values at least from a txt file, but it uses only the last one in the file. - SET /A var+=1 is an easier way to increment a variable. [ -x FILE] True if FILE exists and is executable. Essentially, take the first 3 characters of the sub variable (which was previously set to be the customer string) and make them the new sub variable. › Making a batch file to pull variable from txt › [Solved] Batch File To Set Registry Values As Variables › Batch File to set variable of a file name › Batch file to set font in notepad › Create batch file to set time in TL1 language › How to set up a batch file to rename files › Batch file to find file and set DIR to PATH. This video discusses the use of variables in Windows Batch File ASCII character animations. Here's the kicker. Finally, I'll echo what @VasiliSyrakis says: If you can avoid using cmd. The loop compares the string of bangs to the string i which is set up and loops while the two strings are not equal, on each loop iteration a bang is added to i hence the loop will iterate for the number of bangs in the argument string. This is generally not difficult, as DOS batch file operators are only a limited subset of the equivalent shell scripting ones. txt, then you receive any files prefixed with abcd*. Here is my current code:. The point is that while the batch file Goto and Call commands both provide the ability to repeat lines of code, they do so in an unstructured manner. But what i am trying to do is use a variable in batch file from a txt file to input the "ID" filter to generate multiple reports. txt [/code]And to increase it: [code]ren points. I am struggling with this one for some time now. "I knew of one little DO loop that ran for 48 hours, cost $14,000 and did nothing" ~ Balfour and Marwick Related: FOR - Loop commands. Batch file for loop – looping through files. One is for parameters which can be passed when the batch file is called and the other is done via the set command. Syntax: @rem set_of_files - Set of Files @rem Files separated by standard delimiters. Such variables are called global variables. Each entry in the file must fit within the command line length limit for TCC. If you ever wanted batch file codes that do interesting and fun stuff that you can just scare and amaze your friends with, or just to make it seem like you know allot about computer hacking well than here's the right place. How can I increment a counter or do integer addition in a DOS 7. In batch, use %errorlevel% to reference it. I'm trying to add in a script to measure the time that it takes for each file to execute (not the entire batch file). Copy the above code in a notepad file and save it as a. (Different commands of course). Our predefined grid classes use these same variables and mixins to provide a whole suite of ready-to-use classes for fast responsive layouts. It's rather complicated, because of the way variable expansion in loops works in batch files. The CSV file is State. On systems running a Unix-type shell (for example, Cygwin on Windows) execute the (command) shell instead - cmd for batch files, sh for shell scripts - then pass the batch file or shell script (plus any arguments to the script) as a single command, using the /c or -c switch, respectively. Normally, I invoke CMD. Below is an example of a batch file responsible for displaying some text in your command prompt. This award recognizes someone who has achieved high tech and professional accomplishments as an expert in a specific topic. Please try again later. Instructs the batch file to output a blank line. I know can use notepad and save as bat. This is not an extremely detailed guide, because I believe that it is good to learn about this much of Batch and then start learning something like Python. 1 batch file? I want to create a loop with N iterations that increments an integer input value and assigns an environment variable equal to this integer within each iteration. Below is a sample of code showing where my quandary is. I'm a software developer loving life in Charlotte, NC, an (ISC) 2 CSSLP and an avid fan of Crossfit. ECHO Start of Loop FOR /L %i IN (1,1,5) DO ( ECHO %i ) The 1,1,5 is decoded as: (start,step,end) Also note, if you are embedding this in a batch file, you will need to use the double percent sign (%%) to prefix your variables, otherwise the command interpreter will try to evaluate the variable %i prior to running the loop. after i've run the batch file, but didn't clean up the variables, or just set the variable beforehand for testing) then the IF statements work fine (in that the variable is present, and gets compared). If DWRPATH has a value BEFORE the loop begins (i. The loop will continue until %f variable reaches number 1001, it will go to the subordinate endCopy and exit the program. dbg into your batch file. txt" setlocal EnableDelayedExpansion <"!file!". [Batch file] - Output of a command to variable If you want to set the output of a command to a this needs to be done in for loops or anything after that will. trying to assign Var C to equal 1. for /f %%i in (words. When the string is no longer defined then the length of the string is whatever is in the counter. In my opinion, FOR is the single most powerful command in DOS, and one of the least used. The evaluation of the 'if' statement can be done for both strings and numbers. To set the delimit character, use the following syntax: delims=§. Installing Cygwin. We have created a while loop that reads the file line by line, using getline. that it should open the file you pass in parentheses and set the loop variable to the contents of each line. I'm trying to define and use a variable in a batch file. As mentioned in Chapter 10, "Deploying Scripts for Computer and Network Management," I like to make scripts and batch files "user friendly," not only so that they can be used more easily by other people, but also because I know that three weeks after I write a program, I'll have forgotten how to use it, what it does, and how it works. › How to use 2 variables on a batch file? › [Solved] Batch, assign text file's text to a variable then use it? › [Solved] why do we use %% before a variable in batch file in › Batch File to set variable of a file name › [Solved] Pass a variable from VBS to batch › assign a value and manipulate a variable. Labels normally mark the beginning of a code block that is the target of a GOTO instruction, but they can also be used for comments. exe) to the end of cecho. The CSV file is State. Notice that when the FOR loop finishes we get the correct total, so the variable correctly increments, but during each iteration of the loop the variable will stubbornly display it's initial value of 0 even as we set new values. You could write a C/C++/Java program, but it can take a lot of development time to get even a first-draft program. FOR is an internal command. trying to assign Var C to equal 1. For example, consider the following code. As discussed in the previous tutorial, a batch file is an unformatted text file or script file which contains multiple batch file commands or instructions to achieve a certain task. Click here to go through the introduction of the batch file before learning batch file commands. IF - Conditionally perform a command. bat batch files edit Try Documentalist , my app that offers fast, offline access to 190+ programmer API docs. com I occasionally need to do brute-force scans or commands on networks or computer names and have found many occasions to use a script similar to this. Within the batch file, set the values and scopes of multiple variables by specifying the files containing these variables. Normally, an entire FOR loop is evaluated as a single command even if it spans multiple lines of a batch script. This is not an extremely detailed guide, because I believe that it is good to learn about this much of Batch and then start learning something like Python. Enabling delayed variable expansion can be done using CMD's /V switch, as we used for our exercise, but a better option is to let the batch file itself enable it. Batch File If Else Flowchart. The for loop first creates i variable and assigned a number to i from the list of number from 1 to 5. BAT assumes that there is an editor named EDIT, which takes a file name as its command line argument, in a directory of the system path. [ -x FILE] True if FILE exists and is executable. Examination of the dump file allows tracing the action, step by step and line by line. One can either set the message level using the system variable SYSTEM. I could manually insert a system variable when building the Win7 boxen, & have the script check for it, but I'd prefer not to have to touch each machine. Thanks in advance. Both variables is increased by 1 at the end of the script. Tried WITH and WITHOUT EnableDelayedExpansion, but no joy. When the command processor interprets a batch file, it does it like this: - Read a line of code. jq is like sed for JSON data - you can use it to slice and filter and map and transform structured data with the same ease that sed, awk, grep and friends let you play with text. Using the batch files. Delivering your transactional and marketing emails through the world's largest cloud-based email delivery platform. Based on user input, I want to perform some operation. If you plan on using environment variables as working variables for a batch file, you can use the setlocal command to make any changes to the variables "local" to the batch file. The list in this example is every file with the. site in the R home subdirectory etc is used. So the actual FOR loop we are executing is: for %i in (*) do set LIST= %i which just keeps setting LIST to the last file found. Also, batch file subroutines have no built-in way to return values without relying on environment variables and unintuitive Cmd. As for batch file if else, first a condition of if statement is checked and if true, the statement1 is executed else statement2 is executed. Creating a Batch Command File for Executing SAS with Dynamic and Custom System Options, continued 3 path parameter option %~p1 that is based on the directory path of the SAS program. It has extension of. Im setting the value of the variable from the text file. I have a txt file on my desktop called counter. A batch file is a script file in DOS, OS/2 and Microsoft Windows. the variables (i. When I run a second time, its already set, and outputs its value, ignoring the set until the loop closes. I want to retrieve a file name and assign it to a variable so I can use it further in the script. When the last one is called it hangs the entire process. Below is a sample of code showing where my quandary is. txt [/code]And to increase it: [code]ren points. for /l %%p in (startNumber, increment, endNumber) do command; for /f %%p in (filename) do command. If that file or pathway to the file reaches 241 or More (I forget off the top of my head how to write equal to or greater than in batch) characters, skip the file, write to a log file stating that the specific pathway and the actual fille were not able to be copied and if it is 240 or LSS characters go ahead and copy it. remfp is a file path. One exception is using a wildcard, if the wildcard does not match any files, then FOR will return %ERRORLEVEL% = 5. Windows provides very little support for creating batch files, and none at all for debugging them. So the actual FOR loop we are executing is: for %i in (*) do set LIST= %i. In a command prompt window executing the command line set /A Value=8 % 3 assigns the value 2 to environment variable Value and additionally outputs 2. We may improve this solution via Batch variables that aid to write clearer code. This award recognizes someone who has achieved high tech and professional accomplishments as an expert in a specific topic. In this tutorial, you will learn about batch file commands and how they are used in batch file scripting or programming. In batch file we can create variable two types, one is using the set commands and another is for the parameters which can be passed when the batch file is called. Click here to go through the introduction of the batch file before learning batch file commands. This only works if you know that you are always going to use the characters at specific positions within the string. FOR /D [/r] %%parameter IN (folder_set) DO command FOR /L %%parameter IN (start,step,end) DO command We have a detailed analysis and examples of all these for loops and on my next tutorial, For /F. When we use "Line" as the only variable, then outside of the loop only the last input line is available. txt), you will need to establish a delimitation character. If you plan on using environment variables as working variables for a batch file, you can use the setlocal command to make any changes to the variables "local" to the batch file. › Making a batch file to pull variable from txt › [Solved] Batch File To Set Registry Values As Variables › Batch File to set variable of a file name › Batch file to set font in notepad › Create batch file to set time in TL1 language › How to set up a batch file to rename files › Batch file to find file and set DIR to PATH. One is for parameters which can be passed when the batch file is called and the other is done via the set command. Notice that when the FOR loop finishes we get the correct total, so the variable correctly increments, but during each iteration of the loop the variable will stubbornly display it's initial value of 0 even as we set new values. In all examples and syntax lines shown %A should be substituted with %%A when used in batch files. Note: The operator % must be written in a batch file as %% to be interpreted as operator. Scripting languages became popular as they evolved along with batch processing. If I press CTRL +C like I am going to terminate the batch and give it n then press enter the FOR loop processes correctly. Personally I do not like using variables which match commands as these can cause bad results. I'd like to have conditional branches in my login script (batch file) depending on the OS. That is using SET /P command inside a for loop. In batch file we can create variable two types, one is using the set commands and another is for the parameters which can be passed when the batch file is called. I need to add numbers (variable) together in a batch file so that the sum of the two numbers is used as part of a password. SET variable not working in an 'if' or 'for' loop of windows batch script « on: February 18, 2008, 03:12:47 PM » Once I get into a 'if' block or 'for' loop in a batch script, it doesn't recognize the SET variable. It works by taking the select member code description and the. - Execute it. One exception is using a wildcard, if the wildcard does not match any files, then FOR will return %ERRORLEVEL% = 5. FORFILES - Batch process multiple files. For example, I want to write a batch script which will copy a file to a destination folder, but before copying in destination folder I want it to append the date time stamp in target file name. (The batch splits out the State for use in the path on the new server). How to measure the execution time of a loop in a batch file (beware massive code walls) So I've got a batch file that will execute multiple files using a for loop. If VARIABLE does not exist, the statement is true and control of the batch file jumps to the MODULE section. I use this trick in nearly every batch file I write to determine where the script file itself lives. BAT containing the following code (use copy and paste): @SET VAR= @CD\ @CLS :Loop @ECHO. FOR /R - Loop through files (recurse subfolders). i mean, the value just doesn't go into the variable. Here it goes. To open your CMD, click START > RUN > type "CMD" > OK (some of you may need to type "CMD. If you do a lot of work in Windows batch files, the IF statement offers a very powerful way to add flexibility to your scripts. FOR /R - Loop through files (recurse subfolders). that it should open the file you pass in parentheses and set the loop variable to the contents of each line. DOS has no native way to test for the length of string so what happens in batch files is that the last character of a string is removed and a counter increased by 1. Using ROBOCOPY In A Batch Script To Backup Files & Folders On Windows Vista/7 This isn't so much a question as it is a contribution for those, like myself, who are looking for thorough examples of how to use ROBOCOPY in a batch script (. doc the filename NEWFILE. The point is that while the batch file Goto and Call commands both provide the ability to repeat lines of code, they do so in an unstructured manner. Batch File Operators, If Else, Goto and For Loop We have learned about variables and how to create the variables in batch files and how to manipulate them to perform different computational tasks. During a session you can execute one or more batch files. One is for parameters which can be passed when the batch file is called and the other is done via the set command. The Set parameter can represent a single group of files or several groups of files. This batch file is invoking the SQL Command line utility SQLCMD, the switch –S is used to specify the SQL Server name/instance which should be contacted. Making a Batch File Game on Notepad (part 1): What is a batch file?A batch file is simply a computer program that basically gives a list of instructions for a computer to follow. The "goto" command. for /f %%i in (words. Right-click on a. This file should contain the commands that you want to execute every time R is started under your system. This is not an extremely detailed guide, because I believe that it is good to learn about this much of Batch and then start learning something like Python. sticky bit set. com I occasionally need to do brute-force scans or commands on networks or computer names and have found many occasions to use a script similar to this. Batch File Return Codes with executables. Creating an Array. most executables (not all) do return a returncode. Note: The operator % must be written in a batch file as %% to be interpreted as operator. Simply, the variable %MYFILENAME% is empty right after it's set in a loop: ::echo off se. The same script with EnableDelayedExpansion, gives the same final result but also displays the intermediate values:. In the case of batch file functions with parameters, a tilde(~) sign is used to access them in the main program along with the positional number of parameter. I have two lists or sets of variables if you want that I want to access both dynamically from inside a for loop via DOS batch file. Example: C:\Temp\Files\ contains 6 files, each file contains text. If the file’s MIME type starts with text/ the file is opened in text mode; otherwise binary mode is used. This video discusses the use of variables in Windows Batch File ASCII character animations. So the actual FOR loop we are executing is: for %i in (*) do set LIST= %i. 2- STRUCTURES AND LINKED LISTS IN BATCH FILES The Batch file below simulate structures and linked-list management. FOR /F - Loop through the output of a command. For comprehensive info, see a free Essential Batch book. - Execute it. The Batch file should loop through a text file and store the data as variables. If you need to set each input line to a variable and those variables are available outside of the loop we need a separate variable for each input line. Explains how to increase the modularity, flexibility, and maintainability of your SAS code using the SAS macro facility. Setting a variable in a batch file or on the command line is quite simple. The following things need to be noted when arrays are implemented in Batch Script. No Loops & Description; 1: While Statement Implementation. Of course you can solve this issue. This post explains how to get current date and time from command prompt or in a batch file. Notice the variables. FOR /D [/r] %%parameter IN (folder_set) DO command FOR /L %%parameter IN (start,step,end) DO command We have a detailed analysis and examples of all these for loops and on my next tutorial, For /F. H ow do I run shell loop over set of files stored in a current directory or specified directory? You can use for loop easily over a set of shell file under bash or any other UNIX shell using wild card character. Whatever the need the easiest way to do this is to setup a while loop and execute your code, but in SQL 2005 there is an even easier way to do this. I'm not listing the for loop's full options here as same can be found by running the command 'for /?. Batch file commands: Windows/DOS. %%A %A is for use on command lines only. This is much faster than loading variables from a batch file with multiple SET commands. By Ed Keefe [Note: This article begins by letting you stick your toe in the shallows of programming, but ends by asking you to swim in some deep, uncharted waters. How to loop or start a batch file over after it has completed Updated: 11/13/2018 by Computer Hope You can use the goto command in a batch file to "branch" the execution of your script , skipping to another section of the program. Enabling delayed variable expansion can be done using CMD's /V switch, as we used for our exercise, but a better option is to let the batch file itself enable it. This way, you can easily included it with any batch file. When comparing variables that are strings, it may be best to enclose the variable name in quotes. These starting variables can be accessed with %n where n is the starting variable's number (%1 for the first, %2 for the second. So far in for loop, we have used '%%' followed by a single letter. FOR /F - Loop through items in a text file. FOR /L - Loop through a range of numbers. The problem I have is that I can't figure out how to loop the create machine and increase variable value code until the %M% value is at a defined number. Here is my current code:. I have no idea about writing codes for batch file as I come from a different background,need this for a customer requirement. Note: The operator % must be written in a batch file as %% to be interpreted as operator. the following batch work well until the comment "the following do not perform as expected" I've try any kind of %; %%, ! around the variables but always fail, either do not have any thing or errors. this will grab each line of the locations text file and set it to a variable %%I :: it will take. txt file gets one line bigger, until all of the files have been listed. bat files) - but what I wanted to do with the script snowballed and I found I needed more functionality, the main one being to be able to execute commands based on user input. Here's the kicker. Generations of batch file programmers have tripped over this one. We have created a while loop that reads the file line by line, using getline. By enabling delayed variable expansion and reading the variables the right way. I am sorry for the (really) late update, but better late than never. (The batch splits out the State for use in the path on the new server). %% is the modulo operator in batch files, as % is reserved for expansion of variables. Simple user input in batch files. Sample outputs: Welcome 1 times. Of course, the CheckStyle command is way too long to type each time you want to check on the quality of a source file. cmd) is an example that shows how to read a file and set an environment variable based on the content within the individual records. In this example we have 5 event magnitudes (-e1 input) and 5 event durations (-e2 input). FOR - Loop through a set of files in one folder. I know how to access one list in the loop but not the other. How to set variables in a DOS for loop | Jim's Blog. I was recently playing around with batch scripts (*. This video discusses the use of variables in Windows Batch File ASCII character animations. A batch file has a file extension of ". i was looking online and found an answer here for a number generator between 1 and 10. H ow do I run shell loop over set of files stored in a current directory or specified directory? You can use for loop easily over a set of shell file under bash or any other UNIX shell using wild card character. a variable then displaying the variable show the time when i set that variable. Here is the code, just please don't copy and take it as your own. MSC Industrial Supply is the source for your metalworking and MRO needs. Can stop loop Use IF statement or Break into batch file - + C. Hi, I'm Steve. The following is a list of the environment variables set by PBS for every job. Welcome 4 times. This video discusses the use of variables in Windows Batch File ASCII character animations. I n my never ending desire to use Batch files to do just about anything, I was recently needed batch file to send an email to users once task is completed with “Success” or “Failure” results. Variable Description PBS_ENVIRONMENT set to PBS_BATCH to indicate that the job is a batch job; otherwise, set to PBS_INTERACTIVE to indicate that the job is a PBS interactive job PBS_JOBID the job identifier assigned to the job by the batch system. Provides complete information about macro language elements, interfaces between the SAS macro facility and other parts of SAS software, and macro processing in general. %%P is a parameter that holds what number the for loop is at currently - it can be any letter you like (and some other characters but they are dangerous so stick with letters). If the file does not exist create it. bat file that I have written to do advanced batch scripting the easy way, meaning it's mostly a series of functions you can call from the script or within other functions for extremely modular code. Ideal for performing consistent actions for a set period of time or a. So, as the syntax signifies, first a condition is checked and if true, the corresponding statements are executed in the batch file if statement. The batch file:. FOR /L - Loop through a range. Not working but here is the input / output file. Delivering your transactional and marketing emails through the world's largest cloud-based email delivery platform. When running IM under Windows, you basically have the following alternatives:. exe program restores previous settings when it encounters an endlocal command or reaches the end of the batch file. Click here to go through the introduction of the batch file before learning batch file commands. Use GOTO command to have batch file constructed to behave like a program. I've got a loop that runs all files in a folder. And also we are aware of the SET command and its flags to perform arithmetic calculations and take the inputs from the user. to %# and the suffix (i. FORFILES - Batch process multiple files. The following batch file can be used to run all 25 simulations one after the other:. Tutorialspoint. To allow the caller retrieve the execution flow, it is necessary to use the call command. FOR /D - Loop through several folders. I have a txt file on my desktop called counter. In the case of batch file functions with parameters, a tilde(~) sign is used to access them in the main program along with the positional number of parameter. ̸Ҳ̸ҳ[̲̅B̲̅][̲̅7̲̅][̲̅B̲̅ - de-de. to %# and the suffix (i. Java Example Solution Code; Java String Introduction (video) Java Substring v2 (video) Java String Equals and Loops; Java String indexOf and Parsing; Java If and Boolean Logic If Boolean Logic Example Solution Code 1 (video) If Boolean Logic Example Solution Code 2 (video) Java For and While Loops; Java Arrays and Loops; Java Map. The list in this example is every file with the. NOTE: The quotation marks are necessary only when a variable is used in a logical IF statement. This includes the command-line utilities, as well as the C and C++ APIs. From the aforementioned link: Delayed variable expansion is often useful when working with FOR Loops. At the end of the batch file, or if you use an endlocal command, the environment will be restored to its original state at the time of the setlocal command. Questions: I'm familiar with Unix shell scripting, but new to windows scripting. It's rather complicated, because of the way variable expansion in loops works in batch files. - Execute it. So if you run batchfile param1 param2 from the command line, inside the batch file, %1 would resolve to param1, and %2 would resolve to param2. Although there are very few constructs available for controlling the flow of batch programs, these few can be used imaginatively to accomplish most of the constructs familiar to users of high level languages. for /l %%p in (startNumber, increment, endNumber) do command; for /f %%p in (filename) do command. Such variables are called global variables. The variables created in the previous file can be visited in the following file. Instead of being executed by the “Microsoft Windows Based Script Host” program, Choose Program and select a program that cannot execute files, such as “Notepad” or “Wordpad”. wav sound files using the mplay32. However, if you try to process a for loop on file name with spaces in them you are going to have some problem. Bulk modifications using Set-AdUser Posted on Sunday 9 December 2012 by richardsiddaway The standard approach to the bulk modification of users is to create a CSV file with an identifier and the data you want to change. The local variable only exists within the file of defining it or in a section of that file. You can use the Foreach Loop Container with a Foreach ADO Enumerator for this task. It's a must implement in any stable batch file. Use setlocal to change environment variables when you run a batch file. FOR /R - Loop through files (recurse subfolders). - Perform whatever variable substitution is necessary. bat D:\ >set directoryName = dir Docum?nt* D:\ >echo ECHO is on. But what i am trying to do is use a variable in batch file from a txt file to input the "ID" filter to generate multiple reports. This tutorial explains how to execute MySQL queries by using the phpMyAdmin tool. Variables can be inserted into a batch structure in the form of command line arguements. The input file is just a CSV list of OldUserName,NewUserName. Below is a sample batch script which gets current date and time. But in batch files we don't have any such data type like int, float blah blah. So far in for loop, we have used ‘%%’ followed by a single letter. Regardless it's not a big deal to create a bundle of new variables. The variable %%A doesn't need surrounding double-quotes in the FFMpeg-command. You can add starting variables to the function by adding to it's label. exe program restores previous settings when it encounters an endlocal command or reaches the end of the batch file. The Variable will be used for setting up Outlook email signatures. But to loop through files using for loop, we have to use ‘%’ followed by a single letter like %y. If there are duplicate question please let me know thanks!!^^. First off, this is a single windows. At the end of the batch file, or if you use an endlocal command, the environment will be restored to its original state at the time of the setlocal command. The command "echo off" turns off the display for the whole script, except for the "echo off" command itself. I took the liberty to change it from a batch file into a call function in a batch file. that it should open the file you pass in parentheses and set the loop variable to the contents of each line. To delete data from a table, you use the MySQL DELETE statement. In the case of batch file functions with parameters, a tilde(~) sign is used to access them in the main program along with the positional number of parameter. Delivering your transactional and marketing emails through the world's largest cloud-based email delivery platform. You'll want to look at the EnableDelayedExpansion option for batch files. - Perform whatever variable substitution is necessary. Specifying a group of files. So if you wanted the variable "foo" to be assigned the value "bar" you can use: set foo=bar. Omnistereo panoramas must have a 1:1 aspect ratio" on Google Virtual VR Tour Creator. 5 million products from industry leading suppliers in stock and ready to ship. Create a date and time stamp in your batch files. EXE nach C:\ kopieren und Batch Datei in einem beliebigen Ordner mit FLV/MP4/WAV Dateien anlegen. And sorry if my prior comment came across as harsh. Of course you can solve this issue. I have no idea about writing codes for batch file as I come from a different background,need this for a customer requirement. If I press CTRL +C like I am going to terminate the batch and give it n then press enter the FOR loop processes correctly. Simple user input in batch files. Enabling delayed variable expansion can be done using CMD's /V switch, as we used for our exercise, but a better option is to let the batch file itself enable it. Create a batch file named VAREXP. If you delete the cache of a standalone instance of maximo, you will have to go recreate any users that were set up like the maximouser.