0

I create a file with a batch script. But I have a problem when I use %.

echo WshShell.SendKeys "%" >> fun.vbs

But when I check the vbs script I see this

WshShell.SendKeys "" 

How Can I place the '%' in the vbscript ?

Thanks for your reply !

Tom
  • 119
  • 2
  • 2
  • 11

1 Answers1

2

try double %, i.e. %%

Here is the link to where this is explained. Look at this site, it is an amazing reference for cmd.exe

btw I can't stop myself from recommending you learn linux and bash instead of cmd.exe if you have the choice.

akostadinov
  • 17,364
  • 6
  • 77
  • 85
  • Thank you very much !! This is working. Thanks again. You made my day. I search very long for the sollusions. Didnt know its so easy. – Tom Oct 29 '13 at 20:18
  • @user2355506 What Windows do you have? I have tested it with doubling percentage and in output I had double percentage. – Radu Gheorghiu Oct 29 '13 at 20:19
  • @user2355506, glad it helped. You can click the "Accept" of the answer if you are happy with it. I know you still can't vote. – akostadinov Oct 29 '13 at 20:24
  • 1
    @RaduGheorghiu - Percents must be doubled when in a batch script. But they should not be doubled when used on the command line. – dbenham Oct 29 '13 at 21:00
  • @dbenham I missed the part where he said he runs the command from a batch. Then you are right. – Radu Gheorghiu Oct 29 '13 at 21:02
  • @akostadinov I use Windows 7. It works there. On a standalone pc but also on a domain computer. – Tom Oct 30 '13 at 06:36
  • @dbenham. I creating a batch file with some fun in it. But sometimes i create quickly a vbs script and remove it after wscript stoped. To keep the pc clean. I use Windows 7 Pro and Ultimate. It works on all. – Tom Oct 30 '13 at 06:36