vbscript

DeleteFile with Permission Denied

╄→尐↘猪︶ㄣ 提交于 2021-02-05 07:55:50
问题 I'm running into and issue that has many entries on Stack Overflow, but none of them solved my problem. I have this piece of code, which tries to delete every .txt in a folder, but I keep getting a permission denied error on the "DeleteFile" command: directory = "C:\TEST\FOLDER" Set fso = CreateObject("Scripting.FileSystemObject") Function DeleteTXTs For Each f In fso.GetFolder(directory).Files If LCase(fso.GetExtensionName(f)) = "txt" Then fso.DeleteFile("C:\TEST\FOLDER\*.txt")

Why vbs msgbox wont work with task scheduler for normal users?

末鹿安然 提交于 2021-02-05 06:35:26
问题 I have a simple vbscript that count the number of files/subfolders in a folder, if the number greater than 5, it will pop up a message to user. I can run this script manually under admin or normal user account, but after I scheduled it in task scheduler as admin, it shows task running, [task started] [action started] [created task process] but it never ends and I never see the message box pops up under user accounts. Is there anything wrong? Code: Set filesys = CreateObject("Scripting

Kill all processes with a certain name

六月ゝ 毕业季﹏ 提交于 2021-02-04 20:49:58
问题 I have an HTA that runs a backup routine. For the backup I'm using the SyncToy command line executable, which in some instances does not properly cease. Beacuse of this, I'm trying to kill any process with the name SyncToyCmd.exe . I make use of the window_onBeforeUnload event and call the KillSyncToy() sub from there. The function is correctly detecting instances of the SyncToyCmd.exe , however when trying to kill the process I'm receiving an error - Error: The system cannot find the file

Get Mac Address Using VBScript

冷暖自知 提交于 2021-02-04 18:54:24
问题 I'm trying to put some basic level of protection to an Excel (for Windows) application I'm writing. I was thinking on generating a license file using the machine's mac address. My question is: how can I get the Mac Address using VBScript? 来源: https://stackoverflow.com/questions/16486584/get-mac-address-using-vbscript

VBScript set focus on a window in IE

谁说我不能喝 提交于 2021-02-04 18:09:55
问题 I'm updating an old piece of code that uses VBScript to pull up a window in IE. For some reason, it likes to open up behind IE. Google gave me the following couple lines for setting window focus in VBScript: set WshShell = WScript.CreateObject("WScript.Shell") WshShell.AppActivate("calculator") However, when I run this in IE, I get the error "Object required: 'WScript'." Is there any way around this in IE, or another way to do this? I'm already opening and manipulating a Word document without

VBScript set focus on a window in IE

末鹿安然 提交于 2021-02-04 18:08:36
问题 I'm updating an old piece of code that uses VBScript to pull up a window in IE. For some reason, it likes to open up behind IE. Google gave me the following couple lines for setting window focus in VBScript: set WshShell = WScript.CreateObject("WScript.Shell") WshShell.AppActivate("calculator") However, when I run this in IE, I get the error "Object required: 'WScript'." Is there any way around this in IE, or another way to do this? I'm already opening and manipulating a Word document without

VBScript set focus on a window in IE

自作多情 提交于 2021-02-04 18:07:21
问题 I'm updating an old piece of code that uses VBScript to pull up a window in IE. For some reason, it likes to open up behind IE. Google gave me the following couple lines for setting window focus in VBScript: set WshShell = WScript.CreateObject("WScript.Shell") WshShell.AppActivate("calculator") However, when I run this in IE, I get the error "Object required: 'WScript'." Is there any way around this in IE, or another way to do this? I'm already opening and manipulating a Word document without

VBScript RegEx : Replace Content

吃可爱长大的小学妹 提交于 2021-02-04 16:34:17
问题 I want to update the Unbound_DNS configuration file from a raw source but I can not get the desired result. I would like to format each entry (each line): address=/abc.com/0.0.0.0 To local-zone: "abc.com" redirect local-data: "abc.com 86400 IN A 0.0.0.0" Here is what I did (thanks to hackoofr): Option Explicit Dim URL,Save2File,ws If Not WScript.Arguments.Named.Exists("elevate") Then CreateObject("Shell.Application").ShellExecute WScript.FullName _ , """" & WScript.ScriptFullName & """

VBScript RegEx : Replace Content

蹲街弑〆低调 提交于 2021-02-04 16:34:05
问题 I want to update the Unbound_DNS configuration file from a raw source but I can not get the desired result. I would like to format each entry (each line): address=/abc.com/0.0.0.0 To local-zone: "abc.com" redirect local-data: "abc.com 86400 IN A 0.0.0.0" Here is what I did (thanks to hackoofr): Option Explicit Dim URL,Save2File,ws If Not WScript.Arguments.Named.Exists("elevate") Then CreateObject("Shell.Application").ShellExecute WScript.FullName _ , """" & WScript.ScriptFullName & """

How to click a Link on a webpage using VBScript

99封情书 提交于 2021-02-04 14:18:47
问题 Actually i have to click on a link and as a result it will be give two menu list in that i need to select any of those here is my VBScript for launching IE and navigate to required web adress Dim URL Dim IE Set IE = CreateObject("internetexplorer.application") URL = "http://it-asg.uhc.com/sites/gcas/pcas/archive/PCR/IVM/modlist/Lists/ElementTracker/AllItems.aspx" IE.Visible = True IE.Navigate URL Can any any one help me out to click on that link and select any one of those menu source for the