WUGNET, the Windows User Group Network
Your Complete Resource Center for "The Best" in Shareware, Computing Tips and Support, Windows Industry News... and much more!
Home Forums Shareware Windows Tips Hot Offers FREE Newsletters Arcade Contact Us About Partners
Search WUGNET: RSS Feeds RSS Feeds Advertise with WUGNET    |    Shareware eBooks
HomeHome FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

If-then-else statement in a batch file

 
   Home -> Windows Other -> File System RSS
Next:  Delivery to the following recipients is still und..  
Author Message
joe vaughan

External


Since: Dec 08, 2008
Posts: 1



(Msg. 1) Posted: Mon Dec 08, 2008 11:54 am
Post subject: If-then-else statement in a batch file
Archived from groups: microsoft>public>win2000>file_system (more info?)

I'm running a batch file to unzip some pdf files, and print them. I don't
want the program to run if there isn't a zip file available. I'm trying to
run the following which only gives me a syntax error.

IF not EXIST
"P:\Pyrwin\Reports\shormans\Shorman_eob_print_jobs\processing\working\*.zip"
GOTO END

This isn't working. Any ideas?
Back to top
Login to vote
"Pegasus

External


Since: Dec 22, 2007
Posts: 435



(Msg. 2) Posted: Mon Dec 08, 2008 11:15 pm
Post subject: Re: If-then-else statement in a batch file [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"joe vaughan" <joevaughan DeleteThis @discussions.microsoft.com> wrote in message
news:EFD908BB-0E2F-46EF-B196-43BA7105B758@microsoft.com...
> I'm running a batch file to unzip some pdf files, and print them. I don't
> want the program to run if there isn't a zip file available. I'm trying
> to
> run the following which only gives me a syntax error.
>
> IF not EXIST
> "P:\Pyrwin\Reports\shormans\Shorman_eob_print_jobs\processing\working\*.zip"
> GOTO END
>
> This isn't working. Any ideas?

If you put this all on one single line then it will work:
if not exist "P:\Pyr...\*.zip" goto :eof
Note the inbuilt :eof label, preceded by a colon.
Back to top
Login to vote
admin

External


Since: Dec 20, 2008
Posts: 1



(Msg. 3) Posted: Sat Dec 20, 2008 10:11 pm
Post subject: Re: If-then-else statement in a batch file [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Pegasus (MVP) ´£¨ì:
> "joe vaughan" <joevaughan DeleteThis @discussions.microsoft.com> wrote in message
> news:EFD908BB-0E2F-46EF-B196-43BA7105B758@microsoft.com...
>> I'm running a batch file to unzip some pdf files, and print them. I don't
>> want the program to run if there isn't a zip file available. I'm trying
>> to
>> run the following which only gives me a syntax error.
>>
>> IF not EXIST
>> "P:\Pyrwin\Reports\shormans\Shorman_eob_print_jobs\processing\working\*.zip"
>> GOTO END
>>
>> This isn't working. Any ideas?
>
> If you put this all on one single line then it will work:
> if not exist "P:\Pyr...\*.zip" goto :eof
> Note the inbuilt :eof label, preceded by a colon.
>
>


by adding parentheses, multi lines could be use

if not exit FILENAME (
REM other actions
goto END
)

Mike



-- Posted on news://freenews.netfront.net - Complaints to news DeleteThis @netfront.net --
Back to top
Login to vote
Display posts from previous:   
       Home -> Windows Other -> File System All times are: Eastern Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum
Categories:
 Windows XP
 Windows Vista
  Windows Other
 Office
 Office Other
 Security
  • Home |
  • Shareware |
  • Windows Tips |
  • Hot Offers |
  • FREE Newsletters |
  • Arcade |
  • Forums |
  • eBooks |
  • About WUGNET |
  • Partners |
  • Contact

  • WUGNET Privacy Policy |
  • Link to WUGNET |
  • IT Support