abre o aviso "abrir com" sempre que a tarefa agendada é executada

7

Estou tentando executar um arquivo .vbs a cada cinco minutos.

Estou tentando fazer isso usando o agendador de tarefas do Windows.

Na guia Actions - > New Action , eu seleciono o arquivo ( "D:\Documents\FC3 Savegames\FC3.vbs" ) usando o diálogo de arquivo aberto

Eu fiz todas as outras configurações corretamente.

Mas sempre que a tarefa começar, ela abre o diálogo open with todas as vezes.

Uma vez escolho Notepad para abrir com o diálogo. Em seguida, outra caixa de diálogo é aberta a partir do bloco de notas informando Can not find D:\Documents\FC3.txt file. Do you want to create a new file com três botões Yes , No e Cancel

Ajude-me o que está errado.
Eu sinto que espaços em branco no caminho do arquivo estão causando o problema.

Adicionado mais tarde
Bem, eu apenas consertei isso definindo caminho para abreviar ("D: \ Documents \ FC3Sav ~ 1 \ FC3.vbs"). Mas ainda abre o diálogo "abrir com" toda vez. Agora ele tem dois programas principais dizendo "Continue usando o Microsoft Windows Script Host" e outro programa. Esta caixa de diálogo não abre quando eu executo o arquivo vbs diretamente.

    
por shashwat 24.02.2013 / 17:05

4 respostas

4

Veja o que está escrito sobre o Wscript.exe no arquivo de Ajuda que tenho:

To run scripts using the Windows-based script host (Wscript.exe) You can run scripts with the Windows-based script host in the following ways:

  • By browsing in Windows

    Browse to the folder containing the script you want to run and double-click it. Script files can be listed in My Computer, Windows Explorer, the Find window, the Start menu, or on your desktop.

  • By using the Run command

    Click Start, and then click Run. In Open, type the name of the Windows Host executable file (Wscript.exe), followed by a space, then the full path name of the script you want to run. Be sure to include the file name extension of the script file. Click OK to start the script.

  • From a command prompt window

    At the command prompt, type the name of the Windows Host executable file (Wscript.exe), followed by a space, then the full path name of the script you want to run. Be sure to include the file name extension of the script file. Press Enter to start the script.

Notes

  • Windows scripts are files with the following file name extensions: .wsf, .vbs, .js.
  • If you double-click a script file whose extension has not been associated with Wscript.exe, the Open With dialog box appears. Select Wscript.exe, then select Always use this program to open this file type. This registers Wscript.exe as the default script host for files of this file type.
  • You can use the Windows Script Host Settings dialog box to set global scripting properties for all scripts that Wscript.exe runs on the local computer.
  • You can set properties for individual scripts. See Related Topics for information about how to do this.
  • You can also use Windows Script Host to create .wsf script files, with which you can call multiple scripting engines and perform multiple jobs, all from one file.

Veja o que diz sobre o Cscript.exe:

Using the command-based script host (CScript.exe)

Cscript.exe is a command-line version of the Windows Script Host that provides command-line options for setting script properties.

With Cscript.exe, you can run scripts by typing the name of a script file at the command prompt. Like Microsoft Internet Explorer, Windows Script Host serves as a controller of Windows Script compliant scripting engines, but Windows Script Host has very low memory requirements. Windows Script Host is ideal for both interactive and non-interactive scripting needs, such as logon scripting and administrative scripting.

Windows Script Host supports scripts written in VBScript or JScript. When you start a script from your desktop or from the command prompt, the script host reads and passes the specified script file contents to the registered script engine. The script engine uses file extensions (that is, .vbs for VBScript and .js for JScript) to identify the script. As a result, you do not need to know the exact programmatic identifier (that is, the ProgID) of the script engine. The script host maintains a mapping of script extensions to programmatic identifiers, and uses the Windows XP association model to start the appropriate engine for a given script.

Atualização:

Aqui está um arquivo de registro chamado "FixVBSFileAssociationsXP.reg" que irá corrigir as assocações de arquivos para você no XP. Um diferente seria necessário para o Win 7.

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.reg]
@="regfile"

[HKEY_CLASSES_ROOT\.reg\PersistentHandler]
@="{5e941d80-bf96-11cd-b579-08002b30bfeb}"

[HKEY_CLASSES_ROOT\regfile]
@="Registration Entries"
"EditFlags"=dword:00100000

[HKEY_CLASSES_ROOT\regfile\DefaultIcon]
@=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\
  00,5c,00,72,00,65,00,67,00,65,00,64,00,69,00,74,00,2e,00,65,00,78,00,65,00,\
  2c,00,31,00,00,00

[HKEY_CLASSES_ROOT\regfile\shell]

[HKEY_CLASSES_ROOT\regfile\shell\edit]

[HKEY_CLASSES_ROOT\regfile\shell\edit\command]
@=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\
  00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,4e,00,4f,00,\
  54,00,45,00,50,00,41,00,44,00,2e,00,45,00,58,00,45,00,20,00,25,00,31,00,00,\
  00

[HKEY_CLASSES_ROOT\regfile\shell\open]
@="Mer&ge"

[HKEY_CLASSES_ROOT\regfile\shell\open\command]
@="regedit.exe \"%1\""

[HKEY_CLASSES_ROOT\regfile\shell\print]

[HKEY_CLASSES_ROOT\regfile\shell\print\command]
@=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\
  00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,4e,00,4f,00,\
  54,00,45,00,50,00,41,00,44,00,2e,00,45,00,58,00,45,00,20,00,2f,00,70,00,20,\
  00,25,00,31,00,00,00

Aqui está uma versão chamada FixVBSFileAssociationsVista.reg para o Vista e o Windows 7, que pode funcionar no Windows 8 também, mas use a seu próprio risco (faça o backup do seu registro primeiro, se possível): / p>

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.VBS]
@="VBSFile"

[HKEY_CLASSES_ROOT\.VBS\PersistentHandler]
@="{5e941d80-bf96-11cd-b579-08002b30bfeb}"

[HKEY_CLASSES_ROOT\VBScript]
@="VB Script Language"

[HKEY_CLASSES_ROOT\VBScript\CLSID]
@="{B54F3741-5B07-11cf-A4B0-00AA004A55E8}"

[HKEY_CLASSES_ROOT\VBScript\OLEScript]

[HKEY_CLASSES_ROOT\VBSFile]
"FriendlyTypeName"=hex(2):40,00,25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,\
  00,6f,00,6f,00,74,00,25,00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,\
  32,00,5c,00,77,00,73,00,68,00,65,00,78,00,74,00,2e,00,64,00,6c,00,6c,00,2c,\
  00,2d,00,34,00,38,00,30,00,32,00,00,00
@="VBScript Script File"

[HKEY_CLASSES_ROOT\VBSFile\DefaultIcon]
@=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\
  00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,57,00,53,00,\
  63,00,72,00,69,00,70,00,74,00,2e,00,65,00,78,00,65,00,2c,00,32,00,00,00

[HKEY_CLASSES_ROOT\VBSFile\ScriptEngine]
@="VBScript"

[HKEY_CLASSES_ROOT\VBSFile\ScriptHostEncode]
@="{85131631-480C-11D2-B1F9-00C04F86C324}"

[HKEY_CLASSES_ROOT\VBSFile\Shell]
@="Open"

[HKEY_CLASSES_ROOT\VBSFile\Shell\Edit]

[HKEY_CLASSES_ROOT\VBSFile\Shell\Edit\Command]
@=hex(2):22,00,25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,\
  00,25,00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,4e,00,\
  6f,00,74,00,65,00,70,00,61,00,64,00,2e,00,65,00,78,00,65,00,22,00,20,00,25,\
  00,31,00,00,00

[HKEY_CLASSES_ROOT\VBSFile\Shell\Open]

[HKEY_CLASSES_ROOT\VBSFile\Shell\Open\Command]
@=hex(2):22,00,25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,\
  00,25,00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,57,00,\
  53,00,63,00,72,00,69,00,70,00,74,00,2e,00,65,00,78,00,65,00,22,00,20,00,22,\
  00,25,00,31,00,22,00,20,00,25,00,2a,00,00,00

[HKEY_CLASSES_ROOT\VBSFile\Shell\Open2]
@=hex(2):4f,00,70,00,65,00,6e,00,20,00,26,00,77,00,69,00,74,00,68,00,20,00,43,\
  00,6f,00,6d,00,6d,00,61,00,6e,00,64,00,20,00,50,00,72,00,6f,00,6d,00,70,00,\
  74,00,00,00
"MUIVerb"=hex(2):40,00,25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,\
  6f,00,74,00,25,00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,\
  00,77,00,73,00,68,00,65,00,78,00,74,00,2e,00,64,00,6c,00,6c,00,2c,00,2d,00,\
  34,00,35,00,31,00,31,00,00,00

[HKEY_CLASSES_ROOT\VBSFile\Shell\Open2\Command]
@=hex(2):22,00,25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,\
  00,25,00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,43,00,\
  53,00,63,00,72,00,69,00,70,00,74,00,2e,00,65,00,78,00,65,00,22,00,20,00,22,\
  00,25,00,31,00,22,00,20,00,25,00,2a,00,00,00

[HKEY_CLASSES_ROOT\VBSFile\Shell\Print]

[HKEY_CLASSES_ROOT\VBSFile\Shell\Print\Command]
@=hex(2):22,00,25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,\
  00,25,00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,4e,00,\
  6f,00,74,00,65,00,70,00,61,00,64,00,2e,00,65,00,78,00,65,00,22,00,20,00,2f,\
  00,70,00,20,00,25,00,31,00,00,00

[HKEY_CLASSES_ROOT\VBSFile\ShellEx]

[HKEY_CLASSES_ROOT\VBSFile\ShellEx\DropHandler]
@="{60254CA5-953B-11CF-8C96-00AA00B8708C}"

[HKEY_CLASSES_ROOT\VBSFile\ShellEx\PropertySheetHandlers]

[HKEY_CLASSES_ROOT\VBSFile\ShellEx\PropertySheetHandlers\WSHProps]
@="{60254CA5-953B-11CF-8C96-00AA00B8708C}"
    
por 24.02.2013 / 18:14
5

Velha pergunta, mas eu também a encontrei e isso me ajudou a resolver o meu problema, então eu pensei em compartilhar o que funcionou para mim. Configurar o comando para C:\Windows\System32\wscript.exe e passar o caminho para o meu script como um argumento fez com que funcionasse como um encanto, sem outras modificações necessárias. Aqui está uma captura de tela para referência:

Configurações para scripts agendados:

    
por 15.08.2016 / 01:23
3

Acabei de ter o mesmo problema. Descobriu-se que o Windows 8 não tolera espaços e aspas em nomes de arquivos. No "campo Program / scripts", em vez de

"D:\Documents\FC3Sav~1\FC3.vbs"

você deve usar

D:\Documents\FC3Sav~1\FC3.vbs

Portanto, se você remover os dois espaços e aspas do campo "Programa / script", o script agendado será executado normalmente sem aparecer a caixa de diálogo "Abrir com".

    
por 26.12.2014 / 21:28
2

Como programa selecione cscript.exe e como parâmetro aponte para o arquivo VBS.

    
por 24.02.2013 / 18:07