What I'd like to do (if possible), is, insead of echoing to a file, I'd like to be able to create 2 variables. something like;

processname1.exe processname3.exe <-- (for each process 'checked' if it IS running, append its name to this variable)
commandlinepath1 commandlinepath2 <-- (for each process 'checked' if it IS running, append its path to this variable)

If this is possible, and I can then call on these variable later in my script, I'd like to be able to tskill the running processes (easy enough if the variables above can be made), then later on, RE-OPEN these processes (using and command line parameter that were in the original path. This is where I'm lost.

But What I need to do, is take each line of this file (or variable if possible), and run them (if I copy each line into the RUN command of windows, it works, but doing it through CMD it doesn't).

I've tried using a for loop to open the files, and it does, except the script waits for the process to finish beford continuing (and these process won't end, since they are applications). If I try to use START .. then it loads a new CMD window??

What I need to do (in case there is a better option) is

for a pre-determined set of processes, check to see if they are running

kill the ones that are (if they are not, fine ignore it)

delete some files (I can do this, the reason for killin the processes is they hold the files open, preventing deletion)

If the EXE file is a console program (text-based), START would open a new window. If the EXE file is a GUI program, START won't open a new window. Forcing to use /B parameter without waiting a console program to finish (without /WAIT) would cause input conflict since both CMD and the program is run in the same window and any input will be given to both at the same time.
–
JayAug 15 '12 at 17:34

What it does:
First for supplies process names. In my example, it simply is notepad.exe, but you could call with a list: for (process1 process2 process3), or replace it with for /f to supply values from file. If you want to use quoted names, you would have to remove quote from next line (description^="%%C").
Second for does real work: it gets a list of all processes matching description and sequentially stops and starts each of them.

To try it, simply put it in a batfile.bat, open notepad(s) and execute.
Note: if you open notepad with a file, either specify an absolute path, or do it via explorer (double click). The issue here is of current directory - which you could also stumble upon if any of your processes does reference relative paths (unlikely, but not impossible)

Last but not least - doing that in powershell would be the easiest, shortest and most reliable.