2013-07-24 128 views
1

我遇到的问题是在批处理文件中,最后我尝试打开两个资源管理器窗口,然后用记事本.txt文件与从一个文件夹复制文件的说明到另一个。批处理文件 - 按特定顺序打开文件

当我执行批处理文件时,.txt文件将在两个资源管理器窗口之间打开,当我希望打开它时。有没有办法做到这一点?感谢您的时间!

explorer "C:\program files (x86)\SEL\SEL5010" 
    explorer C:\users\public\temp\SEL5010 

    ECHO. >>C:\users\public\temp\SEL5010\Instructions.txt 
    ECHO Hello %username%, >>C:\users\public\temp\SEL5010\Instructions.txt 
    ECHO. >>C:\users\public\temp\SEL5010\Instructions.txt 
    ECHO Copy SEL5010.lic >>C:\users\public\temp\SEL5010\Instructions.txt 
    ECHO. >>C:\users\public\temp\SEL5010\Instructions.txt 
    ECHO FROM: The C:\users\public\temp\5010 folder. 
    ECHO TO: The C:\Program Files (x86)\SEL\SEL5010 folder. 

    notepad C:\users\public\temp\SEL5010\Instructions.txt 
+0

尝试更换'notepad'用'explorer'也。为了使这个工作正确,你需要深入一些东西,然后进行批处理。 –

回答

0

当你说 “上面” 你的意思是 “最大化”?在这种情况下,尝试

explorer "C:\program files (x86)\SEL\SEL5010" 
explorer "C:\users\public\temp\SEL5010" 

echo Some instructions >%temp%\instructions.txt 
START /MAX notepad %temp%\instructions.txt 

对您可以使用其他参数的更多信息,请阅读HELP START

不过,如果你只是想显示一些说明,为什么不把他们直接在控制台?

ECHO Some instructions 
PAUSE 

or in a message box?

(echo msgbox "Some instructions" >%temp%\m.vbs) && call %temp%\m.vbs 

,进一步拟订第二种方法,你可以把一个消息框,一个文本文件的内容

(echo msgbox CreateObject^(^"Scripting.FileSystemObject^"^).OpenTextFile^(^"%temp%^\instructions.txt^"^).ReadAll >%temp%\m.vbs) && call %temp%\m.vbs 
+0

这是一个有用的解决方案,谢谢! msgbox结束了为我工作的最好,它看起来不那么笨重,只是打开一个文本文件。 – mtb856

+0

欢迎您。如果您觉得这个答案有用,请将其投票。 –

+0

我还不能= /需要更多的声誉,那么我会。 – mtb856

0

这个作品在这里:

@ECHO OFF &SETLOCAL 
explorer folder1 
explorer folder2 
PING -n 2 localhost >nul 
notepad file