Ask Question Forum:
Model Library:2025-02-08 Updated:A.I. model is online for auto reply question page
C
O
M
P
U
T
E
R
2
8
Show
#
ASK
RECENT
←
- Underline
- Bold
- Italic
- Indent
- Step
- Bullet
- Quote
- Cut
- Copy
- Paste
- Table
- Spelling
- Find & Replace
- Undo
- Redo
- Link
- Attach
- Clear
- Code
Below area will not be traslated by Google,you can input code or other languages
Hint:If find spelling error, You need to correct it,1 by 1 or ignore it (code area won't be checked).
X-position of the mouse cursor
Y-position of the mouse cursor
Y-position of the mouse cursor
Testcursor
caretPos
Attachment:===
Asked by bozer
at 2024-07-05 20:28:57
Point:150 Replies:10 POST_ID:828936USER_ID:11835
Topic:
Microsoft Server;;MS DOS
Hello experts.
I have a simple batch which collects these inputs at the beginning:
I have a simple batch which collects these inputs at the beginning:
@echo offset /p startTime="Start Time [in format = 09:15:00]: "set /p endTime="End Time [in format = 18:15:00]: " 1:2:3:
I want to use a second batch file (secondBatch.bat) to call this batch file (firstBatch.bat)
How can I send the input parameters for firstBatch. bat within secondBatch.bat file?
I tried:
and
...they did not work
Thank you in advance
Expert: David Johnson, CD, MVP replied at 2024-07-07 23:20:34
one that works Win 7 and above
@echo offSET startTime=%~1SET endTime=%~2echo Start Time:%startTime%echo End Time: %endTime%CMD /C batch1.bat %startTime% %endTime%batch1.bat %startTime% %endTime% 1:2:3:4:5:6:7:
Expert: dragon-it replied at 2024-07-06 00:45:12
BTW would suggest something like:
@echo off
Set start=%~1
Set end=%~2
If "%start%"=="" set /p start=enter start time...return for 09:00:00
If '%start%"=="" set start=09:00:00
Etc. So if you call batch with time it uses it. If not it prompts you to enter. If not use a default...
@echo off
Set start=%~1
Set end=%~2
If "%start%"=="" set /p start=enter start time...return for 09:00:00
If '%start%"=="" set start=09:00:00
Etc. So if you call batch with time it uses it. If not it prompts you to enter. If not use a default...
Expert: duncanb7 replied at 2024-07-05 23:09:25
Thanks for your points
Have a nice day
Duncan
Have a nice day
Duncan
Author: bozer replied at 2024-07-05 23:05:18
Thanks
Accepted Solution
Expert: duncanb7 replied at 2024-07-05 22:56:11
150 points EXCELLENT
FirstBatch.bat
===========
@echo off
echo %~1
echo %~2
Secondbatch.bat
==============
@echo off
set /p startTime=%~1
set /p endTime=%~2
COMMAND /C firstBatch.bat %startTime% %endTime%
firstBatch.bat %startTime% %endTime%
On Command Shell Type or run:
Secondbatch "09:00:00" "18:00:00"
Is it what you need.We are not understanding what you need completely.
Could you write down what exactly you need input and output from those two files?
Hope understand your question completely.If not please point it out
Duncan
===========
@echo off
echo %~1
echo %~2
Secondbatch.bat
==============
@echo off
set /p startTime=%~1
set /p endTime=%~2
COMMAND /C firstBatch.bat %startTime% %endTime%
firstBatch.bat %startTime% %endTime%
On Command Shell Type or run:
Secondbatch "09:00:00" "18:00:00"
Is it what you need.We are not understanding what you need completely.
Could you write down what exactly you need input and output from those two files?
Hope understand your question completely.If not please point it out
Duncan
Expert: Bill Prew replied at 2024-07-05 22:30:52
On mobile right now, so didn't include any error checking for missing prams, but try this, it should give you the basic idea. Here are the two batch files.
Author: bozer replied at 2024-07-05 22:26:01
firstBatch.bat:
--------------------
@echo off
set /p startTime="Start Time in [format = 09:15:00] "
echo %startTime%
set /p endTime="End Time in [format = 18:15:00] "
echo %endTime%
pause
secondBatch.bat
------------------------
@echo off
set /p startTime="Start Time [in format = 09:15:00]: "
set /p endTime="End Time [in format = 18:15:00]:
COMMAND /C firstBatch.bat %startTime% %endTime%
firstBatch.bat %startTime% %endTime%
When I call secondBatch.bat from command line, it still asks about my startTime and endTime.
Thanks
--------------------
@echo off
set /p startTime="Start Time in [format = 09:15:00] "
echo %startTime%
set /p endTime="End Time in [format = 18:15:00] "
echo %endTime%
pause
secondBatch.bat
------------------------
@echo off
set /p startTime="Start Time [in format = 09:15:00]: "
set /p endTime="End Time [in format = 18:15:00]:
COMMAND /C firstBatch.bat %startTime% %endTime%
firstBatch.bat %startTime% %endTime%
When I call secondBatch.bat from command line, it still asks about my startTime and endTime.
Thanks
Expert: duncanb7 replied at 2024-07-05 22:09:30
Yes, batch file call batch file, put it in secondBatchbat to call first batch file
What you mean ?
Duncan
What you mean ?
I tried this and I still get the 'input parameter' part
Duncan
Author: bozer replied at 2024-07-05 22:02:59
Hi Duncan,
Apologies, I am not very familiar with batch scripting. Can you tell me how to try this? Is this a single batch file? Or the content of secondBatch.bat? I tried this and I still get the 'input parameter' part.
Apologies, I am not very familiar with batch scripting. Can you tell me how to try this? Is this a single batch file? Or the content of secondBatch.bat? I tried this and I still get the 'input parameter' part.
Expert: duncanb7 replied at 2024-07-05 21:49:43
Could your try this ?
@echo off
set /p startTime="Start Time [in format = 09:15:00]: "
set /p endTime="End Time [in format = 18:15:00]:
COMMAND /C firstBatch.bat %startTime% %endTime%
firstBatch.bat %startTime% %endTime%
Duncan
@echo off
set /p startTime="Start Time [in format = 09:15:00]: "
set /p endTime="End Time [in format = 18:15:00]:
COMMAND /C firstBatch.bat %startTime% %endTime%
firstBatch.bat %startTime% %endTime%
Duncan