[ SOLVED ] ? Problem with batch creating vbs ?

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Dos_Probie
Posts: 233
Joined: 21 Nov 2010 08:07
Location: At My Computer

[ SOLVED ] ? Problem with batch creating vbs ?

#1 Post by Dos_Probie » 24 Oct 2013 03:41

Have this Batch file that I need to add some vbs script to then run it from the temp folder
everything copies to temp except this one line:
echo WshShell.Sendkeys "%FC" >> "%tmp%\theme.vbs"
Thanks for any help on this..DP

Here is the complete code..

Code: Select all

@echo off
echo Set WshShell = WScript.CreateObject("WScript.Shell") > %tmp%\theme.vbs
echo WshShell.Run "%windir%\\resources\\themes\\aero.theme" >> %tmp%\theme.vbs
echo Wscript.Sleep 1000  >> %tmp%\theme.vbs
echo WshShell.AppActivate("Desktop Properties")>> %tmp%\theme.vbs
echo WshShell.Sendkeys "%FC" >> %tmp%\theme.vbs
echo WshShell.Sendkeys "{F4}" >> %tmp%\theme.vbs
wscript.exe %tmp%\theme.vbs
Last edited by Dos_Probie on 24 Oct 2013 05:38, edited 2 times in total.

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: ? Problem with batch creating vbs ?

#2 Post by foxidrive » 24 Oct 2013 04:14

Double the percent. Is that the issue?

Dos_Probie
Posts: 233
Joined: 21 Nov 2010 08:07
Location: At My Computer

Re: ? Problem with batch creating vbs ?

#3 Post by Dos_Probie » 24 Oct 2013 04:54

Thanks Foxi! yes the problem was with using a single precent sign (%)
Working now..DP :wink:

Code: Select all

echo WshShell.Sendkeys "%%FC" >> "%tmp%\theme.vbs"

serverdelux
Posts: 36
Joined: 04 Oct 2013 14:14

Re: [ SOLVED ] ? Problem with batch creating vbs ?

#4 Post by serverdelux » 27 Oct 2013 18:19

Good job on solving the nested .vbs write subtracts % problem

On the subject of .vbs does anyone know how to write an .vbs that uses a wmic licences status check and if 0 calls a .bat file then ends

If other than 0 then does nothing and simply ends

Thanks

p.s. 0 = notifications status

p.s.s.

I have the call 1.bat code already

Code: Select all

set WSHShell = CreateObject("WScript.Shell")
WSHShell.Run "1.bat", 1, True

Post Reply