Reputation: 11
I was trying to get cmd.exe to check if my file exists, I wrote this:
if system32/format.dll exists
goto start
else
start startuperror.vbs
then I saved it and it give me a error and at the same time it closed, I could just see the error in the command prompt window before it closed. (I found out by a answer)
Upvotes: 0
Views: 80
Reputation: 41244
Here is an alternative:
if not exist "c:\windows\system32\format.dll" (
start "" startuperror.vbs
) else (
echo The dll exists.
)
pause
Upvotes: 1
Reputation: 116140
try
if exist c:\system32\format.dll goto start
start startuperror.vbs
goto :end
:start
rem Whatever you want to do here if the dll exists.
:end
echo Quitting. Press a key
pause
But for the next time. Start cmd
first. In the command prompt you can navigate to the right directory and start your script. That will allow you to see the actual output. Also, most command have some built in documentation if you add /?
. For instance if /?
.
Upvotes: 1