songz
V2EX  ›  问与答

bat 双击运行下第四行无法像预期的那样生成 bat 文件,求指导

  •  
  •   songz · Dec 16, 2015 · 1809 views
    This topic created in 3809 days ago, the information mentioned may be changed or developed.
    @echo off
    set /p n=input project name(输入项目名字):

    md %n%\doc %n%\render %n%\music %n%\picture %n%\export %n%\project %n%\original

    echo md ^%date:~3,2^%^%date:~6,2^%>%cd%\%n%\original\data.bat

    @pause
    exit
    Supplement 1  ·  Dec 17, 2015
    相当于 bat 里 echo xxxx>xxx.bat
    和 cmd 里 echo xxxx>xxx.bat
    运行的结果是不一样的,怎么解决呢
    Supplement 2  ·  Dec 17, 2015
    解决
    @echo ON
    set /p n=input project name(输入项目名字):

    md %n%\doc %n%\render %n%\music %n%\picture %n%\export %n%\project %n%\original

    echo 1 > %n%\original\date.bat

    set q=md %%date:~5,2%%%%date:~8,2%%

    echo %q% > %n%\original\date.bat

    @pause
    exit
    2 replies    2015-12-16 22:58:26 +08:00
    jiezhi
        1
    jiezhi  
       Dec 16, 2015
    去掉 echo
    songz
        2
    songz  
    OP
       Dec 16, 2015
    @jiezhi 不行,运行出错
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2556 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 42ms · UTC 16:00 · PVG 00:00 · LAX 09:00 · JFK 12:00
    ♥ Do have faith in what you're doing.