Jump to content

Recommended Posts

Posted

Hey,

 

I am a photographer and am trying to make a .bat file to open photos when I take a photo onto my PC, I have canon software that will get it off my camera via the data lead but now I need to make a bat file to open it in windows gallery then 10 seconds later close it! But I cant get it to work!

 

Here is that I have the first line works and opens the image, its the sleep for 10 seconds and the closing of windows gallery...

 

C:\WINDOWS\system32\rundll32.exe C:\WINDOWS\System32\shimgvw.dll,ImageView_Fullscreen %~1

sleep 10

TASKKILL /F /IM "rundll32.exe"

 

 

Any ideas?

 

Dan

Posted (edited)

Vbscript version below :

 

Dim oShell
Dim intSleep

intSleep = 10 * 1000

Set oShell = WScript.CreateObject ("WSCript.shell")
Set WshNetwork = WScript.CreateObject("WScript.Network")

oShell.run "rundll32.exe %SystemRoot%\system32\shimgvw.dll,ImageView_Fullscreen"

wscript.sleep intSleep

Dim objWMIService, objProcess, colProcess
Dim strComputer, strProcessKill
strComputer = WshNetwork.ComputerName
strProcessKill = "'rundll32.exe'"

Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")

Set colProcess = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = " & strProcessKill )
For Each objProcess in colProcess
objProcess.Terminate()
Next
[b]WSCript.Echo "Just killed process " & strProcessKill _
& " on " & strComputer[/b]
WScript.Quit 
oShell = Nothing

First attempt so appologies if it does not work or if there are some coding ommisions.

 

You can get rid of the messagebox at the end of you wish just delete the 2 lines in bold in the coded example.

 

You can download the text version below and rename the file extension from txt to vbs and run it :)

script.txt

Edited by mac_shinobi

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...