Windows script need help

Please support our Computer Science advertiser: Learn about neural networks and artificial intelligence.
Reply

Join Date: Nov 2006
Posts: 10
Reputation: phreaqhopp is an unknown quantity at this point 
Solved Threads: 0
phreaqhopp phreaqhopp is offline Offline
Newbie Poster

Windows script need help

 
0
  #1
Nov 24th, 2006
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
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 2,356
Reputation: masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of 
Solved Threads: 252
Moderator
masijade's Avatar
masijade masijade is offline Offline
Nearly a Posting Maven

Re: Shell script need help

 
0
  #2
Nov 24th, 2006
I'm sorry, but Do Your Own Homework. Or at least make an attempt at it.
Java Programmer and Sun Systems Administrator

----------------------------------------------

Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 10
Reputation: phreaqhopp is an unknown quantity at this point 
Solved Threads: 0
phreaqhopp phreaqhopp is offline Offline
Newbie Poster

Re: Shell script need help

 
0
  #3
Nov 24th, 2006
Originally Posted by masijade View Post
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 ;-)
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 5,051
Reputation: John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold 
Solved Threads: 332
Team Colleague
John A's Avatar
John A John A is offline Offline
Vampirical Lurker

Re: Shell script need help

 
0
  #4
Nov 24th, 2006
Originally Posted by phreaqhopp View Post
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
"Technological progress is like an axe in the hands of a pathological criminal."
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 10
Reputation: phreaqhopp is an unknown quantity at this point 
Solved Threads: 0
phreaqhopp phreaqhopp is offline Offline
Newbie Poster

Re: Shell script need help

 
0
  #5
Nov 24th, 2006
Originally Posted by joeprogrammer View Post
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:
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 5,051
Reputation: John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold 
Solved Threads: 332
Team Colleague
John A's Avatar
John A John A is offline Offline
Vampirical Lurker

Re: Shell script need help

 
0
  #6
Nov 25th, 2006
Originally Posted by phreaqhopp View Post
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:

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.

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.
"Technological progress is like an axe in the hands of a pathological criminal."
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 10
Reputation: phreaqhopp is an unknown quantity at this point 
Solved Threads: 0
phreaqhopp phreaqhopp is offline Offline
Newbie Poster

Re: Shell script need help

 
0
  #7
Nov 26th, 2006
Originally Posted by joeprogrammer View Post
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 ;-)
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 10
Reputation: phreaqhopp is an unknown quantity at this point 
Solved Threads: 0
phreaqhopp phreaqhopp is offline Offline
Newbie Poster

Re: Shell script need help

 
0
  #8
Nov 27th, 2006
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
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 10
Reputation: phreaqhopp is an unknown quantity at this point 
Solved Threads: 0
phreaqhopp phreaqhopp is offline Offline
Newbie Poster

Re: Shell script need help

 
0
  #9
Nov 27th, 2006
)
ELETE
del *.*
GOTO :EXIT


ABOVE: it seems an emoticon jumped in there that is supposed to be CALL : DELETE (w/o the space)
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 5,051
Reputation: John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold 
Solved Threads: 332
Team Colleague
John A's Avatar
John A John A is offline Offline
Vampirical Lurker

Re: Shell script need help

 
0
  #10
Nov 27th, 2006
Originally Posted by phreaqhopp View Post
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.)
Originally Posted by phreaqhopp View Post
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
"Technological progress is like an axe in the hands of a pathological criminal."
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Computer Science Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC