Teknoratti
Technical User
Greetings,
I'm looking for assistance in converting some of the language of a batch file into a vbs script.
I have a batch script that first looks for the existence of two particular files, "file1" or "file2"
If "file1" is present it jumps down to a section of the script stated by the GOTO command
If "file2" is present it jumps down to a different section of the script stated by the GOTO command.
ex: If Exist C:\<folder name>\file1.txt GOTO Script1:
If Exist C:\<folder name>\file2.txt GOTO Script2:
My question is, from my reading of Microsoft's VB Script step by step, it seems that I'll have to use the If..Then statement. Am I on the right track?
Please explain the logic as well, so that I can understand. Thanks in advance.
Here's the batch script which I'll need to convert to vbs language
==========================================================
If Exist C:\<folder name>\file1.txt GOTO Script1:
If Exist C:\<folder name>\file2.txt GOTO Script2:
GOTO Script1
:Script1
net use E: \\<server>\<folder>\%USERNAME% /PERSISTENT:NO
net use F: \\<server>\<folder> /PERSISTENT:NO
net use G: \\<server>\<folder> /PERSISTENT:NO
net use H: \\<server>\<folder> /PERSISTENT:NO
net use I: \\<server>\<folder> /PERSISTENT:NO
net use lpt1: \\<server>\HPLJ /PERSISTENT:NO
net use lpt2: \\<server>\HPLJ /PERSISTENT:NO
GOTO DONE
:Script2
net use E: \\<server>\<folder>\%USERNAME% /PERSISTENT:NO
net use F: \\<server>\<folder> /PERSISTENT:NO
net use G: \\<server>\<folder> /PERSISTENT:NO
net use H: \\<server>\<folder> /PERSISTENT:NO
net use I: \\<server>\<folder> /PERSISTENT:NO
net use lpt1: \\<server>\HPLJ /PERSISTENT:NO
net use lpt2: \\<server>\HPLJ /PERSISTENT:NO
GOTO DONE
ONE
==================================================
I'm looking for assistance in converting some of the language of a batch file into a vbs script.
I have a batch script that first looks for the existence of two particular files, "file1" or "file2"
If "file1" is present it jumps down to a section of the script stated by the GOTO command
If "file2" is present it jumps down to a different section of the script stated by the GOTO command.
ex: If Exist C:\<folder name>\file1.txt GOTO Script1:
If Exist C:\<folder name>\file2.txt GOTO Script2:
My question is, from my reading of Microsoft's VB Script step by step, it seems that I'll have to use the If..Then statement. Am I on the right track?
Please explain the logic as well, so that I can understand. Thanks in advance.
Here's the batch script which I'll need to convert to vbs language
==========================================================
If Exist C:\<folder name>\file1.txt GOTO Script1:
If Exist C:\<folder name>\file2.txt GOTO Script2:
GOTO Script1
:Script1
net use E: \\<server>\<folder>\%USERNAME% /PERSISTENT:NO
net use F: \\<server>\<folder> /PERSISTENT:NO
net use G: \\<server>\<folder> /PERSISTENT:NO
net use H: \\<server>\<folder> /PERSISTENT:NO
net use I: \\<server>\<folder> /PERSISTENT:NO
net use lpt1: \\<server>\HPLJ /PERSISTENT:NO
net use lpt2: \\<server>\HPLJ /PERSISTENT:NO
GOTO DONE
:Script2
net use E: \\<server>\<folder>\%USERNAME% /PERSISTENT:NO
net use F: \\<server>\<folder> /PERSISTENT:NO
net use G: \\<server>\<folder> /PERSISTENT:NO
net use H: \\<server>\<folder> /PERSISTENT:NO
net use I: \\<server>\<folder> /PERSISTENT:NO
net use lpt1: \\<server>\HPLJ /PERSISTENT:NO
net use lpt2: \\<server>\HPLJ /PERSISTENT:NO
GOTO DONE
ONE
==================================================