944,103 Members | Top Members by Rank

Ad:
You are currently viewing page 1 of this multi-page discussion thread
Nov 24th, 2006
0

Windows script need help

Expand Post »
Anyone wanna take a crack at this?

Display “File Maintenance Script” in the title bar

Clear the screen

Display a menu of options for delete, rename or exit

Using called procedures, either delete all files in H:\scripts, rename all files so that they have the extension .bak, or simply exit the program
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
phreaqhopp is offline Offline
10 posts
since Nov 2006
Nov 24th, 2006
0

Re: Shell script need help

I'm sorry, but Do Your Own Homework. Or at least make an attempt at it.
Moderator
Reputation Points: 1471
Solved Threads: 490
Industrious Poster
masijade is offline Offline
4,043 posts
since Feb 2006
Nov 24th, 2006
0

Re: Shell script need help

Click to Expand / Collapse  Quote originally posted by masijade ...
I'm sorry, but Do Your Own Homework. Or at least make an attempt at it.
I am sorry fry but that wasn't the answer I was looking for ;-)
Reputation Points: 10
Solved Threads: 0
Newbie Poster
phreaqhopp is offline Offline
10 posts
since Nov 2006
Nov 24th, 2006
0

Re: Shell script need help

Click to Expand / Collapse  Quote originally posted by phreaqhopp ...
I am sorry fry but that wasn't the answer I was looking for ;-)
Too bad. It's pretty obvious that this is your homework, and asking for help without showing any effort is not encouraged here. Post the code you've got so far, and we might be able to help you with it.

Thanks
Team Colleague
Reputation Points: 2240
Solved Threads: 338
Vampirical Lurker
John A is offline Offline
5,055 posts
since Apr 2006
Nov 24th, 2006
0

Re: Shell script need help

Too bad. It's pretty obvious that this is your homework, and asking for help without showing any effort is not encouraged here. Post the code you've got so far, and we might be able to help you with it.

Thanks
No sweat. And glad it was obvious. It was supposed to be. <bfg> I am not doing any complex DB extraction or anything. I think it is presumptious of you to "assume" I have put in no effort. Remember what happens when you assume? "You make a donkey out of yourself" :cheesy:
Reputation Points: 10
Solved Threads: 0
Newbie Poster
phreaqhopp is offline Offline
10 posts
since Nov 2006
Nov 25th, 2006
0

Re: Shell script need help

Click to Expand / Collapse  Quote originally posted by phreaqhopp ...
No sweat. And glad it was obvious. It was supposed to be. <bfg> ... I think it is presumptious of you to "assume" I have put in no effort. Remember what happens when you assume? "You make a donkey out of yourself" :cheesy:
OK, look buddy. We're simply not going to do your homework, and insulting us isn't going to make it go any better. If you have been making an effort, you should at least be able to figure out a few of the steps. Tell us which part of the assignment you need help on, or don't understand. For example:

Quote ...
Using called procedures, either delete all files in H:\scripts, rename all files so that they have the extension .bak, or simply exit the program
You should have at least tried to do it. Post some of your attempts; it shows us that you actually want to get it done, and not simply let us do your homework.

Quote ...
I am not doing any complex DB extraction or anything.
Also the fact that you were "disguising" the fact that it was homework is annoying; when you say "Anyone want to take a crack at this," you're making it sound as if it's supposed to be a brainteaser for us to solve. But it's pretty easy to tell that it's your homework, so why not say so?

Not to be harsh or anything, and I'm happy to help you with a part that you're stuck on. But me (and everyone else) don't want you to get marked on something you didn't write.

Thanks.
Team Colleague
Reputation Points: 2240
Solved Threads: 338
Vampirical Lurker
John A is offline Offline
5,055 posts
since Apr 2006
Nov 26th, 2006
0

Re: Shell script need help

OK, look buddy. We're simply not going to do your homework, and insulting us isn't going to make it go any better. If you have been making an effort, you should at least be able to figure out a few of the steps. Tell us which part of the assignment you need help on, or don't understand. For example:

You should have at least tried to do it. Post some of your attempts; it shows us that you actually want to get it done, and not simply let us do your homework.

Also the fact that you were "disguising" the fact that it was homework is annoying; when you say "Anyone want to take a crack at this," you're making it sound as if it's supposed to be a brainteaser for us to solve. But it's pretty easy to tell that it's your homework, so why not say so?

Not to be harsh or anything, and I'm happy to help you with a part that you're stuck on. But me (and everyone else) don't want you to get marked on something you didn't write.

Thanks.
Nothing was disguised. You give me too much credit. But, that's OK I'll Mark you ;-)
Reputation Points: 10
Solved Threads: 0
Newbie Poster
phreaqhopp is offline Offline
10 posts
since Nov 2006
Nov 27th, 2006
0

Re: Shell script need help

Sorry I apologise I thought I would have had more time to respond, but with the holiday and all, anyway I am sorry. I did not mean to insult you. If I did I humbly take it back. I just have a joking-around sense of humor and I guess you'd have to know me to know that. So once again I apologize :-( to :-) I appreciate you comments on the code I am posting below. I am on the road and do not have access to a compilier so forgive any obvious errors. I am sure there is a simplier way but this is my first crack into scripting so here goes...
ps you might even cringe when you see this!
@ECHO off
REM *****************************************************************
REM
REM Script Name: File_Maintenance_Script.bat
REM Author: ME

REM
REM Description: ****************************************************
REM I. Display “File Maintenance Script” in the title bar II. Clear the screen III. Display a menu of options for delete, rename or exit
Using called procedures, either delete all files in H:\scripts, rename all files so that they have the extension .bak, or simply exit the program

REM *****************************************************************

REM Script Initialization Section
IF NOT "%OS%" == "Windows_NT" ECHO Unsupported Operating Systems & GOTO :EOF
 
REM Main Processing Section
REM ****Create the scripts directory****
MKDIR scripts
REM****Sets command line to scripts directory****
cd/scripts
title File Maintenance Script
REM Clear the display
cls
echo (1) delete (2) rename (3) exit
REM *wait to accept input from a keyboard*
:NUMBER
  IF %1 GTR %3% (
    CLS
    ECHO.
    ECHO.
    ECHO Too high, try again
    ECHO.
    ECHO.
    
    PAUSE
  )
IF %1 LSS %1% (
    CLS
    ECHO.
    ECHO.
    ECHO Too low, try again
    ECHO.
    ECHO.
    
    PAUSE
  )
IF %1 EQU %1% (
    CLS
    ECHO.
    ECHO.
    ECHO You have decided to DELETE this directory's contents
    ECHO.
    ECHO.
    
    PAUSE
    CALL :DELETE
)
  )
IF %1 EQU %2% (
    CLS
    ECHO.
    ECHO.
    ECHO You have decided to RENAME this directory's file extensions all to *.bat
    ECHO.
    ECHO.
    CALL :RENAME
    
    PAUSE
)
  )
IF %1 EQU %3% (
    CLS
    ECHO.
    ECHO.
    ECHO You have decided to EXIT
    ECHO.
    ECHO.
    CALL :EXIT
    
    PAUSE
)
:DELETE
del *.*
GOTO :EXIT
:RENAME
     REN *.* *.bat
     GOTO :EXIT
 
:EXIT
     exit
Last edited by WaltP; Nov 29th, 2006 at 5:11 am. Reason: Added code tags
Reputation Points: 10
Solved Threads: 0
Newbie Poster
phreaqhopp is offline Offline
10 posts
since Nov 2006
Nov 27th, 2006
0

Re: Shell script need help

)
ELETE
del *.*
GOTO :EXIT


ABOVE: it seems an emoticon jumped in there that is supposed to be CALL : DELETE (w/o the space)
Reputation Points: 10
Solved Threads: 0
Newbie Poster
phreaqhopp is offline Offline
10 posts
since Nov 2006
Nov 27th, 2006
0

Re: Shell script need help

Click to Expand / Collapse  Quote originally posted by phreaqhopp ...
I am on the road and do not have access to a compilier so forgive any obvious errors.
Several things I have to point out:
  • Although this is shell scripting, it's certainly Windows, and not Linux. And since I'm running Linux/BSD, I can't test any modifications I make on the code, even if I could understand Windows shell scripting.
  • You don't need a compiler to run this code. COMMAND.EXE simply "interprets" the code, so there's no compilation necessary.
Since you may not get excessive help here in the Linux forum, you may want to ask a mod to move it for you to the appropriate forum (there's not one dedicated to Windows shell scripting, but I'm sure they know where to move it.)
Click to Expand / Collapse  Quote originally posted by phreaqhopp ...
ABOVE: it seems an emoticon jumped in there that is supposed to be CALL : DELETE (w/o the space)
This problem would go away if you used code tags. They're highly encouraged here, and to use them, you simply insert your code in between [code] and [/code]. And then your code will look nicely formatted, retaining indentation:
CALL:DELETE
Team Colleague
Reputation Points: 2240
Solved Threads: 338
Vampirical Lurker
John A is offline Offline
5,055 posts
since Apr 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Computer Science Forum Timeline: Time complexity
Next Thread in Computer Science Forum Timeline: Sparse Matrix & List





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC