File requirement checks as one liner?
Posted: 12 Oct 2016 07:12
Hi,
I'm revising a script, looking for simplifications. The script needs three files to process.
This is what its author originally wrote:
So it's the same type of instruction just repeated and I thought of merging this into a one liner if possible.
Basically, what I'd like to achieve is: Check if file0 ... file2 all exist and continue if these files are present.
Otherwise the script should exit with a message (Required file missing).
This
will output StdErr, i.e. the first missing file name but not my defined message.
How would you proceed?
I'm revising a script, looking for simplifications. The script needs three files to process.
This is what its author originally wrote:
Code: Select all
If Not Exist 7z.dll Echo 7z.dll missing &Goto :EOF
If Not Exist 7zFM.exe Echo 7zFM.exe missing &Goto :EOF
If Not Exist 7zG.exe Echo 7zG.exe missing &Goto :EOF
So it's the same type of instruction just repeated and I thought of merging this into a one liner if possible.
Basically, what I'd like to achieve is: Check if file0 ... file2 all exist and continue if these files are present.
Otherwise the script should exit with a message (Required file missing).
This
Code: Select all
For /f %%f In (7z.dll 7zFM.exe 7zG.exe) Do (If Not Exist %%~f Echo Missing file, exiting...)
How would you proceed?