-1

I'm trying to make a Batch file that creates a VBS in the Windows Directory so that it can execute an ALT-F4 whenever it wants. (Just a joke / annoying thing) but I'm having issues. The % sign that's needed in the VBS script won't write. Everything but the % sign writes.

@echo Set WshShell = WScript.CreateObject("WScript.Shell")> SENDKEYS.vbs
@echo WshShell.SendKeys "%{F4}">> SENDKEYS.vbs

Anybody know why this is?

So da
  • 7
  • 1

1 Answers1

1

As per my comment, when using a batch file the percent character, %, must be doubled:

@Echo Off
(   Echo Set WshShell = WScript.CreateObject("WScript.Shell"^)
    Echo WshShell.SendKeys "%%{F4}"
)>"SENDKEYS.vbs"
Compo
  • 30,301
  • 4
  • 20
  • 32