[Solved] How to convert .Net code to vbscript?

You have to use the FileSystemObject. Hint: This could be googled very easily. Example: Sub HideFolderFiles(filespec) Dim fs, f, r Set fs = CreateObject(“Scripting.FileSystemObject”) Set f = fs.GetFolder(filespec).Files f.attributes = 2 ‘hidden End Sub Source: https://www.experts-exchange.com/questions/28054761/VBScript-to-set-file-attributes.html 2 solved How to convert .Net code to vbscript?

[Solved] Build path and use in external command

Use the appropriate FileSystemObject methods when handling paths: Set fso = CreateObject(“Scripting.FileSystemObject”) SCRIPT_PATH = fso.GetParentFolderName(WScript.ScriptFullName) SCRIPT_PATH = fso.BuildPath(SCRIPT_PATH, “Delete_App_Script.ps1”) For using variables inside strings you need to concatenate the variables to the rest of the string, as @Lankymart pointed out. This is also documented in the language tag info. objShell.Run “RUNAS /user:Domain\User “”powershell ” & … Read more

[Solved] Install font batch file and vbscript

Finally I found the solution, special thank to JosefZ, as he said Powershell is the solution, All you need is download and copy Add-font.ps1 by Michael Murgolo to your project folder and copy below lines into your batch file: @echo off PowerShell Set-ExecutionPolicy RemoteSigned PowerShell -command “& ‘%~dp0Add-Font.ps1’ -path ‘%~dp0myFont.ttf'” Note you must run this … Read more

[Solved] Share Excel.Application executable among multiple WSF processes?

Usage of GetObject() is documented in this old KB article. Error handling is required to get the first instance created. Like this: Dim excel On Error Resume Next Set excel = GetObject(, “Excel.Application”) If Err.number = 429 Then Set excel = CreateObject(“Excel.Application”) End If If Err.number <> 0 Then WScript.Echo “Could not start Excel: ” … Read more

[Solved] search for string in text file in vb and print lines

A very bad formed question for this site. It’s good for you to spend some time to read the rules. Anyway, this is from me. Const ForReading = 1, ForWriting = 2 Dim FSO, FileIn, FileOut, strTmp Set FSO = CreateObject(“Scripting.FileSystemObject”) Set FileIn = FSO.OpenTextFile(“shar.txt”, ForReading) Set FileOut = FSO.OpenTextFile(“sha.txt”, ForWriting, True) Do Until FileIn.AtEndOfStream … Read more