Running a stubborn executable in Dos Batch file - windows

I've got a pretty stubborn executable that I would like to execute sequentially multiple times from within a Dos batch file. (Due to IT constrains currently constrained to using Dos batch files.)
I am able to use START to launch the executable, however, it seems the executable is expecting the user to hit return prior to "really" running/executing.
In a DOS Batch script is there anyway work with an executable that is expecting the user to hit return prior to running? I would like for the "return" to be in the script and not have to actually click on the window and manually hit return.
Thank you for any feedback provided.
P.S. Figured out that /wait option in START so that the next execution will start right up once the first one is finished and so on, but having trouble figuring out how to input a "return".

You can use
echo.|DoStuff.exe
provided your executable is a console program.

You can pipe the input from other file, for example,
Write a text file with one carriage return and call it like..
start "YourExe.exe < text.txt",

Related

Is it possible to automate writing text into an existing DOS program that has text inputs?

For example, I have a DOS program that prompts for a file input name. It uses that name to find the file needed to run analysis on and also to generate the output report filename. If I had a list of filenames that I wanted to run in the program, can I automate the action of writing those filenames into the dos program one by one and running the program for each one somehow? Ideally, I could run the program for all filenames by just clicking go somehow.

Prevent Program (.exe) from starting DIRECTLY (Only allow execution from shortcut)?

Is there a way to prevent direct startup of a .exe program, and only start up when a shortcut is run? I'd like this to work also when opening up a filetype that is assigned to a program.
The only thing that comes close to what you want is checking for certain command line parameters. This is actually a rather common way for concealed executions - for instance programs that want you to run a loader program first (online games would be an example).
So you would have to generate a shortcut that privdes the specific command line arguments needed for the start. This ensures that your exe cannot be executed directly, however there are no guaranties that a specific shortcut file is startet as it only provides a link to the exe file.
No, that is not possible, in my knowledge.
This is not possible, the shortcut is executing the program in its location. The .exe has to be executable for the shortcut to work. Assigned file extensions also execute the actual .exe the shortcut is just a symbolic link to the actual file.
If you can give more information as to what your trying to accomplish I could maybe offer another solution.
I'm not aware of any way built in to do this, as an executable is still launched as that user by the shortcut. You can disable shortcut locations, allow only certain executables, etc but not deny access to executable but also allow it via shortcut.

Output entire console output to text file

I inherited a Windows batch file that is just over 6,000 lines long, and it is running as a scheduled task on Windows Server 2003 R2.
There are some echoes and redirects here and there in the batch code for writing to log files, but there are a couple of hundred calls and commands that are not logged.
So I want to capture the entire console output to a text file for evaluation and debugging.
I found a couple of solutions posted, but none I have tried actually work.
Is there a way to do this without having to add to the batch code itself in a couple of hundred places to try and get what I need?
Write a wrapper:
wrapper.cmd
call batch.cmd >>logfile.txt
you could also try to wrap you whole file body in
(
<body>
) >>logfile.txt
but that can be wonky depending on what's going on in the body, i found.

how do I run my .py file from within python command line?

background info:
I know this question has been asked countless times, but I'm not understanding the answers.
Today is the first time I've ever done anything with python, so I'm a total noob.
I'm using windows 7.
python 3.3.5 lives here: C:\Python33\python.exe
I have a .py file I want to run saved here: C:\Users\Scydmarc\Documents\cs188\python_basics\myfile.py
If I simply double click on myfile.py, it opens, runs, and closes super fast. By doing a perfectly timed printscreen, I can see that it works. It is my understanding that I need to run the file from within python.exe to get the window to stay open and allow me to mess with variables etc after it runs. So I open python.exe. What exactly do I need to type to run myfile.py? I've found lots of people trying to do this, but I guess I'm not understanding the answers. When I try to follow along, I get tangled up with errors. Do you still need to put python before the file name while in the python.exe window? Do I somehow need to specify a full path to the file? Some are actually running from the windows command prompt and not the python command prompt. When trying to change PYTHONPATH, are you supposed to do that from inside python, or the windows command prompt? Some examples use '/', while some use '\'. So, I think a complete example (what to actually type, in what window, line by line, with real filepaths) would clarify a lot for me and be super helpful. I'm thinking if I can actually see it done once, I can figure out how to make it do what I want in the future. Thanks for any help you can give.
in your python dir type python.exe pathtofile.py or set python.exe to your classpath
edit: https://www.youtube.com/watch?v=IokKz-LZsEo

Building a Visual Basic script that uses a batch file

I've written a batch file script that takes an image sequence from a certain folder, converts it to quicktime using ffmpeg and then it moves the file to a certain folder.
I used variables at the beginning of the batch script for user input on which folder to take the files from.
And now for my question: The batch I've written works just fine but I want to make it into a simple visual basic script so it looks nice and clean instead of a command prompt interface.
Can anyone provide me with tips for the VB code?
How do I pass variables from VB to the batch file?
Any help on this would be much appriciated.
Use a HTML Application to program the GUI to gather the info needed from the user. Use WScript.Shell's .Run or .Exec method to start an external process (either the .bat or ffmpeg directly) and pass those info via the command line.

Resources