I am trying to run a .vbs
file on every five minutes.
I am trying to do this using windows task scheduler.
In Actions
tab -> New Action
, I select the file ("D:\Documents\FC3 Savegames\FC3.vbs"
) using open file dialog
I have made all other setting properly.
But whenever the task begin, It opens open with
dialog every time.
Once I choose Notepad
to in open with dialog. Then Another dialog opens from Notepad saying Can not find D:\Documents\FC3.txt file. Do you want to create a new file
with three buttons Yes
, No
and Cancel
Help me what is wrong.
I feel that white spaces in the file path causing the problem.
Added later
Well I just fixed this by setting path to shorthand ("D:\Documents\FC3Sav~1\FC3.vbs"). But it still opens "open with" dialog everytime. Now it has two main programs saying "Keep using Microsoft Windows Script Host" and Other Program. This dialog does not open when I run vbs file directly.
Answer
Here's what it says about Wscript.exe in the Help file I have:
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.
Here's what it says about 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.
Update:
Here's a registry file called "FixVBSFileAssociationsXP.reg" which will fix up the file assocations for you on XP. A different one would be needed for 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
Here's a version called FixVBSFileAssociationsVista.reg
for Vista and Window 7, which might work on Windows 8, too, but use at your own risk (back up your registry first, if possible):
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}"
No comments:
Post a Comment