|
Answer» Win XP SP.3
Can the Shift command be used when setting environment variables in the command environment from the LOCAL environment? A code snippet is shown below and I'd like to Shift the variables, if that is possible, instead of using the SET command underlined===== I've tried various combinations without success.
I have attached the full script and emphasize that this is a work-in-progress, at this time I only need INFORMATION about Shift(ing).
Thanks guys.
Code: [Select]:: Calculate elapsed time call :Elapsed %StartHour% %StartMins% %StartSecs% %StopHour% %StopMins% ^ %StopSecs% Hours Minutes Seconds
:: Calculate elapsed time and set environment variables in the command :: shell environment :Elapsed setlocal set /a ElapsedSecs=3600*%4+60*%5+%6-(3600*%1+60*%2+%3) if %ElapsedSecs% LSS 0 set /a ElapsedSecs=%ElapsedSecs%+24*3600 set /a h=(%ElapsedSecs%/3600) set /a m=(%ElapsedSecs%/60)-60*%h% set /a s=%ElapsedSecs%-60*(%ElapsedSecs%/60) endlocal&set %7=%h%&set %8=%m%&set %9=%s%&set Elsecs=%ElapsedSecs%&goto :EOF :: ================
[recovering disk space - old attachment deleted by admin]shift replaces %1 with %2 etc not variblesThe shift command. It is used to process a list of items where you process a few items from left end of the list and then you do a shift and process a few more items and do a shift in process a few more items and so on. I don't know that this will help or not. Here is a very simple shift that is only for the purpose of showing what the shift does.
Code: [Select]set AA=one set BB=two set CC=three set DD=four CALL :SEEME %AA% %BB% %CC% %DD% GOTO END :SEEME ECHO %1 %2 SHIFT ECHO %1 %2 SHIFT ECHO %1 %2 :END Quote from: Valerie ....I'd like to Shift the variables.... Quote from: Mat123shift replaces %1 with %2 etc not varibles Correct Mat123, I should have said "I'd like to change the position of command line parameters....". I hope others are not confused by my misuse of terminology.
Geek-9pm - Thank you for the demo.
V.
|