[batch] set how do i set a complex line

April 16, 2010 at 11:14:15
Specs: Windows XP
set mountix_install=if "%install_mnt_found%"=="no" ( %cmd_mountix_install% ) else ( echo ... *** error: existing mount detected. )

i want to add an additional line after the echo, such as "beep"

so yeah, beep + error.

.


See More: [batch] set how do i set a complex line

Report •


#1
April 16, 2010 at 13:28:01
not exactly sure what you're doing here, but there's GOT to be a better way!

Report •

#2
April 16, 2010 at 13:49:18
i use %mountix_install% multiple times ... (kinda like a function)

there's a test some place previously to see if something is mounted... and so if not it sets variable install_mnt_found = no, and if it hasn't been mounted, itll run cmd_mountix_install.. and if not, itll just say an existing mount's there. now since i multi task a lot, sometimes i'd like to know if theres an error, and here i use a pc speaker beep.

but yeah maybe you have a better idea? lol

.


Report •

#3
April 16, 2010 at 21:09:00
ah, i see now i think.
mountix_install contains the (sub)script. kind of unusual way of doing it, usually people just:
call mountix_install
:mountix_install
if "%install_mnt_found%"=="no" ( %cmd_mountix_install% ) else ( echo ... *** error: existing mount detected. )
but in yours, after the initial load, you just:
%mounix_install%
ok. when i first viewed it, i thought you were trying to assign the output of the IF to the variable, which seemed overly complicated.
to get the beep you want, you prob'ly need to use DEBUG or EDIT to create a file with asci sevens (ctrl-Gs) in it.
EDIT BEEP
ctrl-P
(this lets you enter control characters, hit ctrl-G)
duplicate ctrl-G ever how many beeps you want, and save
as "beep" (for example)
or:
copy con beep
^G^G^Z
(hit a couple of ctrl-Gs then ctrl-Z)
or (here's a debug-script with two beeps):
@goto :aa
e100 7 7
rcx
2
nbeep
w
q
:aa
if exist beep goto :alrdydone
debug < %0.bat
:alrdydone
echo testing the beeper:
type beep
::------ end
in your script, once you have create "beep", just:
TYPE BEEP
:: or you can just:
echo 
@echo off & setlocal



Report •

Related Solutions

#4
April 19, 2010 at 02:20:45
Not sure what mountix_install should be doing, but here it goes:
I've changed no to yes, cause it does not make sense if No

call mountix_install
if "%install_mnt_found%"=="yes" %cmd_mountix_install%
else (
echo ... *** error: existing mount detected.
beep
)


Report •


Ask Question