Knightsman
asked on
Run a Cmd based on text file contents
Thanks for the help in advance
I'm running some cmds and autoit scripts, and I want to create a text file for the programs that need to restart the computer on occasion. When the program calls for a restart, the cmd creats a text file that marks what program ran lasts, and on startup, I want the cmd line to run the next program based on the text file contents. Pretty much, program 1 will only have the #1 in the text file.
I'm still rather new to coding, and I have a good handle on it, and can read and learn with playing with stuff, but I cant seem to find any references to this, or if its possible.
Thanks again.
I'm running some cmds and autoit scripts, and I want to create a text file for the programs that need to restart the computer on occasion. When the program calls for a restart, the cmd creats a text file that marks what program ran lasts, and on startup, I want the cmd line to run the next program based on the text file contents. Pretty much, program 1 will only have the #1 in the text file.
I'm still rather new to coding, and I have a good handle on it, and can read and learn with playing with stuff, but I cant seem to find any references to this, or if its possible.
Thanks again.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Good idea, Paul. The RunOnce entry will vanish after being executed. But I assume Knightsman needs more help, as the description of the current process is different.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Do you need your solution in batch file format or AutoIt format?
ASKER
Thanks everyone, going to play with this a little bit. For now its going to be a sequence, probably the same, but will changed depending. Its for antivirus scans, like SAS, malwarebytes, combofix, emsisoft, atf cleaner, ccleaner, etc.
The reason I want batch files with autoIT, is it seems to be easier to run the scripts no matter what the version of windows is. Going to guess as I learn more about Autoit, ill learn to compensate for each OS.
the plan is to just start the next script in line after restart. SAS needs restart, then move to malwarebytes.
I really like the idea of creating the startup in the reg.
matrixnz i dont fully understand exactly what your script is doing but going to try to learn it.
The reason I want batch files with autoIT, is it seems to be easier to run the scripts no matter what the version of windows is. Going to guess as I learn more about Autoit, ill learn to compensate for each OS.
the plan is to just start the next script in line after restart. SAS needs restart, then move to malwarebytes.
I really like the idea of creating the startup in the reg.
matrixnz i dont fully understand exactly what your script is doing but going to try to learn it.
It appears you may be better off doing the whole thing in a batch file...
I'll see if I can put something together for you in the next few moments...
I'll see if I can put something together for you in the next few moments...
.... I'm going to bed !!
ASKER
DIdn't mean to make you work good sir. I appreciate the time you put into this.
AutoIT is compatible with all Windows OSs, however if the software has some dependencies then it's quite easy to accomodate with AutoIT for example, looking at the OSVersion and architecture especially with Windows 7 (see example below)
The code above is just an example basically you're creating an AutoIT Compiled executable which has switches this way you can include all your commands into one script and reference these by just calling them from a commandline.
One of the major pluses about AutoIT is that it also allows a custom Gui Interface.
Cheers
The code above is just an example basically you're creating an AutoIT Compiled executable which has switches this way you can include all your commands into one script and reference these by just calling them from a commandline.
One of the major pluses about AutoIT is that it also allows a custom Gui Interface.
Cheers
If @OSVersion ='Win_XP' Then
Run(....
ElseIf @OSVersion = 'Win_7' and @OSArch = 'x86' Then
Run(...32 bit program...)
Else
Run(...64 bit program...)
EndIf
ASKER
Thanks guys, sorry this took so long