

(Being more realistic would bloat the example without adding much, since you have to adapt the idea for your scenario anyway.) Pressing 9 (& boolean variable incoming_message) is used for ultra-simple simulation for your server-messages. using STDIN.getc with a string-var serving as an input-buffer to reprint the user input. system("stty raw -echo") # to instantly get any typed character in combination withĢ. The two important parts of my proposal are:ġ.
#VBSCRIPT PRINT TO STDOUT FULL#
& "'Win32_Directory.Name=""" & strSource & """'")ĬopyFile()įor a full explanation, you can read Monitoring and Archiving Newly Created Files on my blog. & "Targetinstance ISA 'CIM_Director圜ontainsFile' AND " _ ("SELECT * FROM _InstanceCreationEvent WITHIN 10 WHERE " _ Set colEvents = objWMIService.ExecNotificationQuery _ Set objWMIService = GetObject("winmgmts:" & strComputer & "rootcimv2") It looks like this: strSource = "C:\somefilepath\withdoubleshlashes" You can use a WMI event script with the _InstanceCreationEvent to monitor for new file creation in a specific folder. WScript.Echo "Writeable: " & objFile.Writeable WScript.Echo "Version: " & objFile.Version WScript.Echo "Readable: " & objFile.Readable WScript.Echo "Manufacturer: " & objFile.Manufacturer WScript.Echo "Last modified: " & objFile.LastModified WScript.Echo "Last accessed: " & objFile.LastAccessed WScript.Echo "File system name: " & objFile.FSName WScript.Echo "File type: " & objFile.FileType WScript.Echo "File size: " & objFile.FileSize WScript.Echo "File name: " & objFile.FileName WScript.Echo "Extension: " & objFile.Extension WScript.Echo "Encryption method: " & objFile.EncryptionMethod WScript.Echo "Encrypted: " & objFile.Encrypted

WScript.Echo "8.3 file name: " & objFile.EightDotThreeFileName WScript.Echo "Computer system name: " & objFile.CSName WScript.Echo "Creation date: " & objFile.CreationDate WScript.Echo "Compression method: " & objFile.CompressionMethod WScript.Echo "Compressed: " & objFile.Compressed WScript.Echo "Archive: " & objFile.Archive WScript.Echo "Access mask: " & objFile.AccessMask

("Select * From CIM_DataFile Where FileName Like '" & strQuery & "'") Set objWMIService = GetObject("winmgmts:" _ If Not IsNull(strPath) And strPath "" Then StrPath = Left(strPath, Len(strPath) - 1) WScript.Echo "Folder path does not exist." Set objFso = CreateObject("Scripting.FileSystemObject") But perhaps you can use the strategy to implement something that fits your needs. Decent file handling, quoting in sCmd, cleaning of the returned strings, and dealing with encodings will require more work. Run and temporary files to get something like backticks with a hidden console. SFSpec2 = goFS.BuildPath( sFSpec2, goFS.GetTempName() )ĪRet( 3 ) = """%COMSPEC%"" /c """ + sCmd + " 1>""" + sFSpec1 + """ 2>""" + sFSpec2 + """"""ĪRet( 0 ) = goWSH.Run( aRet( 3 ), SW_SHOWMINNOACTIVE, True )ĪErr = Array( Err.Number, Err.Description, Err.Source )ĪRet( 1 ) = Join( Array( aErr( 1 ), aErr( 2 ), "(BTicks)" ), vbCrLf )įor Each sFSpec In Array( sFSpec2, sFSpec1 )ĭim oFile : Set oFile = goFS.GetFile( sFSpec )ĪRet( nIdx ) = oFile.OpenAsTextStream( ForReading ).ReadAll() This proof of concept script: ' pocBTicks.vbs - poor man's version of backticks (POC)ĭim goFS : Set goFS = CreateObject( "Scripting.FileSystemObject" )ĭim goWSH : Set goWSH = CreateObject( "WScript.Shell" )ĭim aRet : aRet = Array( -1, "", "", "" )ĭim sFSpec2 : sFSpec2 = goFS.GetAbsolutePathName( "." )ĭim sFSpec1 : sFSpec1 = goFS.BuildPath( sFSpec2, goFS.GetTempName() )
