if exist command problems in batch file

April 10, 2011 at 18:22:03
Specs: Windows Server 2008, AMD Penom II x4 3.5ghz/16GB RAM
making a logon script for when users logon onto domain. however when it comes to the if command it keeps say 'exist was unexpected at this time.' and end te batch file what am i doing wrong. :(

@echo off
title Login into MEDURST network...
\\win-1sush32p99r\netlogon\sleep 10
@echo Hello %USERNAME%, welcome to the network!
\\win-1sush32p99r\netlogon\sleep 2
@echo You are accessing the network from %COMPUTERNAME%
\\win-1sush32p99r\netlogon\sleep 2
@echo Please wait, authenticating %USERNAME% with the "MEDHURST" network
@echo And connecting drive M: to Music.
\\win-1sush32p99r\netlogon\sleep 2
@net use M: /del
@net use M: \\WIN-1SUSH32P99R\Music
\\win-1sush32p99r\netlogon\sleep 5
@echo Loading Music Drive for %USERNAME% completed.
\\win-1sush32p99r\netlogon\sleep 2
@echo Loading %USERNAME% files.
if not exist c:\xp.txt (
goto step3
) else (
goto step4
\\win-1sush32p99r\netlogon\sleep 2
@echo Logon setup complete.
@echo Enjoy the "MEDHURST" Network.
\\WIN-1SUSH32P99R\netlogon\sleep 5

See More: if exist command problems in batch file

Report •

April 11, 2011 at 23:12:59
First guess: the goto is breaking the if structure.

Life is too important to be taken seriously.


Report •
Related Solutions

Ask Question