[ASK] Write a Windows batch shell script to shift and call a command using script arguments #12
andry81
started this conversation in
AI models and engines
Replies: 1 comment
-
Engine: Qwen Final result: @echo off
setlocal enabledelayedexpansion
REM This script shifts the first argument and calls a command with the remaining arguments
REM Display the original arguments
echo Original arguments: %*
REM Shift the first argument
shift
REM Display the shifted arguments
set "shifted_args="
:loop
if "%~1"=="" goto endloop
set "shifted_args=!shifted_args! %1"
shift
goto loop
:endloop
REM Trim leading space from shifted_args
set "shifted_args=%shifted_args:~1%"
echo Shifted arguments: %shifted_args%
REM Call a command with the remaining arguments
REM For demonstration, we'll use "echo" as the command, but you can replace it with any command you need
echo Calling command with remaining arguments...
call echo %shifted_args%
REM Uncomment the following line to call a different command with the remaining arguments
REM call your_command %shifted_args%
endlocal Seems the result is a bit better with less iterations. But mostly the same. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Engine: Qwen
Model:
Qwen2.5-Plus
(Capable of complex tasks)Asked:
Help me write a Windows batch shell script to shift and call a command using script arguments.
Final result:
https://chat.qwenlm.ai/s/85c7ba7b-1a16-47ac-afd5-0aab25566ad9
Seems it can not reach the mine variant of the code:
/~https://github.com/andry81/contools/tree/HEAD/Scripts/Tools/std/callshift.bat
😄
Beta Was this translation helpful? Give feedback.
All reactions