• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

VBScript Error

maharaskal

Junior Member
Hi guys,
there is error on the path kindly help me to solve it. thanks in advance

Code:
'-=-=-=Create Folder=-=-=-=-=-

Dim oShell, oEnv, oFS, strDirectory

Set oShell = CreateObject("wscript.Shell")
set oFS = CreateObject("scripting.FileSystemObject")
Set oEnv = oShell.Environment("Process")

strDirectory = oEnv("USERPROFILE") & "\Desktop\VBSLab"
if not oFS.FolderExists(strDirectory) then oFS.CreateFolder(strDirectory)

'-=-=-==-=-=-=-=Retrive sysinf0 & save in txt n open the file =-=-=-=-=-=

Set FSO = CreateObject("Scripting.FileSystemObject")

Set TextFile = FSO.OpenTextFile("%USERPROFILE%") & "\desktop\vbslab\SysInfo.txt", 2, True) ' Error at here
Dim Wsh
Set Wsh = WScript.CreateObject("WScript.Shell")

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colSettings = objWMIService.ExecQuery _
    ("Select * from Win32_OperatingSystem")
For Each objOperatingSystem in colSettings 
    TextFile.Writeline "OS Name: " & objOperatingSystem.Name
    TextFile.Writeline "Version: " & objOperatingSystem.Version
    TextFile.Writeline "OS Manufacturer: " & objOperatingSystem.Manufacturer
    TextFile.Writeline "OS Name: " & objOperatingSystem.SizeStoredInPagingFiles
Next
 Set TextFile = Nothing
 Set FSO = Nothing 
 
Wsh.Run ("%USERPROFILE%") & "\desktop\vbslab\SysInfo.txt", 1 ' Another Error at here also.
WScript.Sleep 800 ' Delay allows Notepad to get the focus.
 
Back
Top