开发者

Command Line - how to extract a file name only when using a for command loop

开发者 https://www.devze.com 2023-01-04 15:24 出处:网络
What I need to do is extract the filename from %%f so I can create the correct dll name. for %%f in (*.asmx.cs) do (

What I need to do is extract the filename from %%f so I can create the correct dll name.

for %%f in (*.asmx.cs) do (
    echo %%f

    cmd /c C:\windows\Microsoft.NET\Framework\v4.0.30319\csc.exe /t:library /r:%assemblies% %compileoptions% /out:开发者_开发问答bin/%%f.dll %%f
)


Use %%~nf.

for %%f in (*.asmx.cs) do (
    echo %%~nf

    cmd /c C:\windows\Microsoft.NET\Framework\v4.0.30319\csc.exe /t:library /r:%assemblies% %compileoptions% /out:bin/%%~nf.dll %%f
)

For a complete list of FOR variable modifiers like %%~nf, run for /? from the command line, or look online here.

0

精彩评论

暂无评论...
验证码 换一张
取 消