Solved how can i fix batch script error to make vbs file

January 26, 2018 at 02:06:01
Specs: Windows 7
I'm scripting a batch file to create a vbs file, but i met a big problem...

@echo off
> "C:1.bat" (
echo(@echo off

echo(set YEAR=%date:~0,4%
echo(set MONTH=%date:~5,2%
echo(set DAY=%date:~8,2%

echo(set HOUR=%time:~0,2%
echo(set MINUTE=%time:~3,2%
echo(set SECOND=%time:~6,2%

echo(choice /t 5 /d n ^> nul

but it prints as following,

@echo off

set YEAR=2018
set MONTH=01
set DAY=26
set HOUR=18
set MINUTE=46
set SECOND=50
update : Y M D H M S
choice /t 5 /d n > nul

i'm wait for your support to prints out as next;

@echo off

set YEAR=%date:~0,4%
set MONTH=%date:~5,2%
set DAY=%date:~8,2%

set HOUR=%time:~0,2%
set MINUTE=%time:~3,2%
set SECOND=%time:~6,2%

choice /t 5 /d n ^> nul

message edited by dragon12321

See More: how can i fix batch script error to make vbs file

Report •

January 26, 2018 at 02:46:45
✔ Best Answer
Inside a BAT one % gets stripped.

Look at what these lines do:



M2 Get custom script or take private lessons

Report •
Related Solutions

Ask Question