batch file help please

Soldato
Joined
4 Jan 2004
Posts
20,802
Location
¯\_(ツ)_/¯
How to I change variable values?

I have a line

set virtualdrive=X

but is there someway I can do something like

virtualdrive = virtualdrive - 1

so virtualdrive becomes V?
 
Is virtualdrive =X , setting virtualdrive to a numeric value ?

If it is then you can use

set /A virtualdrive -= 1

instead of
virtualdrive = virtualdrive - 1

If it is a letter then you will have to use a lookup table type idea to change virtualdrive value


IF virtualdrive == "X" then goto change1

goto continue

:change1
set virtualdrive = V


:continue


Currently in work iam writing batch files to archive data form several pc across and network and rar the data and transfer to a server.

Hope this helps you
 
Back
Top Bottom