简体   繁体   English

Windows 7批处理:执行ECHO的输出

[英]Windows 7 Batch: Execute the Output of ECHO

I want a batch file to run a command like this: 我希望批处理文件运行如下命令:

start Firefox "http://www.billboard.com/charts/hot-100?chartDate=2012-12-01"

I want it to update the date before running, so that tomorrow the executed command will look like this: 我希望它在运行之前更新日期,以便明天执行的命令如下所示:

start Firefox "http://www.billboard.com/charts/hot-100?chartDate=2012-12-02"

I have devised a batch file with these two lines: 我设计了具有以下两行的批处理文件:

set BBURL=start Firefox "http://www.billboard.com/charts/hot-100?chartDate=%date:~10,4%-%date:~4,2%-%date:~7,2%"
echo %BBURL%

These lines give me the command I want, updated each day as shown above. 这些行为我提供了我想要的命令,每天都会更新,如上所示。 But they don't actually run the command. 但是他们实际上并没有运行命令。 So (1) is there a better way to do this and (2) in any event, for future reference, how can I redirect or execute the "echo %BBURL%" output so that it runs as a command? 因此(1)有更好的方法来执行此操作,以及(2)在任何情况下(为了将来参考),如何重定向或执行“ echo%BBURL%”输出,使其作为命令运行?

Cheers! 干杯!

PS The other part of the question, which I forgot to add: how can I subtract, from the year, a number like 40, to get the Billboard listing for 40 years ago today? PS问题的另一部分,我忘了补充:如何从年份中减去40这样的数字,以获得今天40年前的Billboard清单?

Can't you just do: 你不能只是做:

set BBURL=start Firefox "http://www.billboard.com/charts/hot-100?chartDate=%date:~10,4%-%date:~4,2%-%date:~7,2%"
%BBURL%

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM