0

I have the following batch file that when called takes a screen shot of a student's computer, using NirSoft's program -- Nircmd.exe, and saves the file as the user's logon name.tif to a remote server folder. The problem I'm having is when I run the batch file, the command window flashes on the student's computer. I was hoping I could run a Vbscript with the hidden window command to avoid the command window from flashing. I'm new to Batch files and Vbscripts, but have had some success getting this program to work. I'm hoping someone out there can help me with the conversion from batch file to Vbscript. Here is my batch file:

'start "" "C:\Program Files\nircmd-1\nircmd.exe" savescreenshot^
' "K:\Teachers\Other Stuff\Utilities\Tiffs\%USERNAME%.tif" 600 300 600 400'
'exit 

Thanks for your help, John

1
  • It could be beneficial that the student knows they are being randomly monitored, as they will probably behave. if they aren't aware then it's really a privacy issue. Commented Mar 8, 2014 at 8:52

1 Answer 1

1

Utilize the wscript.shell object, and as long as the systems are 32 bit. Activate the vbscript directly, and it should display no command prompt.

dim wshShell
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run """C:\Program Files\nircmd-1\nircmd.exe"" savescreenshot ""K:\Teachers\Other Stuff\Utilities\Tiffs\%USERNAME%.tif"" 600 300 600 400"

If you need to execute it directly under a vbscript application host. Reference the vbscript info [link] for instructions.

Sign up to request clarification or add additional context in comments.

2 Comments

You need to remove the escape character (^) or the command will run without producing the desired screenshot.
Rich, thank you so much. Your code worked perfectly!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.