Showing posts with label bat. Show all posts
Showing posts with label bat. Show all posts

Tuesday, 14 January 2025

Win Bat 批处理带货切片


有的小伙伴需要把我之前一个视频切片的批处理文件变成windows可用的bat文件。文件名字qiepian.bat,代码如下:

```

@echo off


:: Define variable

set SOME_VAR=C:\cygwin\path


:: Remove directory if it exists

if exist "%SOME_VAR%" (

    rd /s /q "%SOME_VAR%"

) else (

    echo "file not found"

)


:: Copy a file

copy /y "C:\some\file" "C:\to\another\file"


:: Check if variable is empty

if "%SOME_VAR%"=="" (

    echo "SOME_VAR is empty"

) else (

    echo "SOME_VAR not empty"

)


:: Define a function

call :my_function

call :my_function "some param"

goto :eof


:my_function

echo hello from my_function: %~1

goto :eof

```

运行也简单,这样就好: qiepian.bat