1

This script is to generate a special Job File for an Altiris deployment system. I need it to output the variables echoed as the variable name, not have the CMD prompt generate the actual varaible. Ex, %TIME% is saved as %TIME%" not, "Wed 04/06/2016 16:30:34.72"

Alternatively, being able to add or remove the REM comment on a specific line would be enough as well.

Also, is it possible to disable having to hit enter after entering Y or N?

:QOne
echo Do you want 3RVX? (Y/N)
set INPUT=
set /P INPUT=Type input: %=%
If /I "%INPUT%"=="y" goto Yes
If /I "%INPUT%"=="n" goto No
:Yes
echo axSched.exe %COMPNAME% "3RVX" /t "%DATE% %TIME%" /y > %NAMEINPUT%.txt
goto QTwo
:No
echo "REM axSched.exe %COMPNAME% "3RVX" /t "%DATE% %TIME%" /y" > NAMEINPUT%.txt

1 Answers1

0

From the interactive command line, you can escape the % characters with ^ so that they're treated as a literal % rather than being used for variable substitution. For example:

C:\pax> echo %time%
10:32:25.94

C:\pax> echo ^%time^%
%time%

From within a cmd file, that doesn't work. In that case, you can double the % characters so that they're treated literally:

@echo off
echo 1 %time%
echo 2 %%time%%
echo 3 ^%time^%

This produces:

1 10:36:14.45
2 %time%
3
paxdiablo
  • 854,327
  • 234
  • 1,573
  • 1,953