How to use VBScript to open notepad and paste current date with DDMMYYYY format in it? -
how use vbscript open notepad , paste current date in ddmmyyyy format?
when use below code, output in dd/mm/yyyy format. want in ddmmyyyy format.
set wshshell = wscript.createobject("wscript.shell") call wshshell.run("%windir%\system32\notepad.exe") dim adate adate = date() wscript.sleep 4000 wshshell.sendkeys adate
could guys please me on one?
the date format want: ddmmyyyy (without common slashes)
this should work you:
dim wshshell: set wshshell = wscript.createobject("wscript.shell") wshshell.run("%windir%\system32\notepad.exe") wscript.sleep 4000 dim adate: adate = wscript.createobject("system.text.stringbuilder").appendformat("{0:dd}{0:mm}{0:yyyy}", now).tostring() wshshell.sendkeys adate
Comments
Post a Comment