This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2011-05-21 10:21:28

TornFusion
Scratcher
Registered: 2010-09-03
Posts: 1000+

.bat help!

Ok, I want to make a script like this:

@echo off
color 1C
echo Welcome to the test
pause
LABEL::
What URL to go to?
start %answer%
pause

how do I do it now? it sdont work!

Offline

 

#2 2011-05-21 10:39:12

ThePCKid
Scratcher
Registered: 2009-09-16
Posts: 1000+

Re: .bat help!

TornFusion wrote:

Ok, I want to make a script like this:

@echo off
color 1C
echo Welcome to the test
pause
LABEL::
What URL to go to?
start %answer%
pause

how do I do it now? it sdont work!

Try this (the only time I use caps a lot is with Batch files):

Code:

@ECHO OFF
COLOR 1C
ECHO Welcome to the test
ECHO What URL do you want to go to?
SET /P ANSWER=
START %ANSWER%
PAUSE

Last edited by ThePCKid (2011-05-21 10:56:17)

Offline

 

#3 2011-05-21 10:47:02

TornFusion
Scratcher
Registered: 2010-09-03
Posts: 1000+

Re: .bat help!

ThePCKid wrote:

TornFusion wrote:

Ok, I want to make a script like this:

@echo off
color 1C
echo Welcome to the test
pause
LABEL::
What URL to go to?
start %answer%
pause

how do I do it now? it sdont work!

Try this (the only time I use caps a lot is with Batch files):

Code:

@ECHO OFF
COLOR 1C
ECHO Welcome to the test
ECHO What URL do you want to go to?
SET /P ANSWER
START %ANSWER%
PAUSE

This doesn't seem to work. It says the syntax is WRONG

Offline

 

#4 2011-05-21 10:50:17

TornFusion
Scratcher
Registered: 2010-09-03
Posts: 1000+

Re: .bat help!

bump. Using windows 7

Offline

 

#5 2011-05-21 10:56:49

ThePCKid
Scratcher
Registered: 2009-09-16
Posts: 1000+

Re: .bat help!

TornFusion wrote:

ThePCKid wrote:

TornFusion wrote:

Ok, I want to make a script like this:

@echo off
color 1C
echo Welcome to the test
pause
LABEL::
What URL to go to?
start %answer%
pause

how do I do it now? it sdont work!

Try this (the only time I use caps a lot is with Batch files):

Code:

@ECHO OFF
COLOR 1C
ECHO Welcome to the test
ECHO What URL do you want to go to?
SET /P ANSWER=
START %ANSWER%
PAUSE

This doesn't seem to work. It says the syntax is WRONG

Oops! I forgot an equals sign. Try the code now.

Offline

 

#6 2011-05-21 12:16:53

TornFusion
Scratcher
Registered: 2010-09-03
Posts: 1000+

Re: .bat help!

thanks! Now, how can i make it sense if person says y or n

Offline

 

#7 2011-05-21 12:32:27

ThePCKid
Scratcher
Registered: 2009-09-16
Posts: 1000+

Re: .bat help!

TornFusion wrote:

thanks! Now, how can i make it sense if person says y or n

Here is something nice: rem denotes a comment.

There are two ways.
1. One command only
2. Multiple commands

Code:

ECHO Blah blah blah? [Y/N]
SET /P VarName=
IF %VarName% == Y rem Command here
IF %VarName% == N rem Command here

Code:

ECHO Blah blah blah? [Y/N]
SET /P VarName=
IF %VarName% == Y GOTO YEAH
IF %VarName% == N GOTO NOPE

:YEAH
rem Commands here

:NOPE
rem Commands here

Last edited by ThePCKid (2011-05-21 12:34:55)

Offline

 

#8 2011-05-21 12:34:47

TornFusion
Scratcher
Registered: 2010-09-03
Posts: 1000+

Re: .bat help!

ThePCKid wrote:

TornFusion wrote:

thanks! Now, how can i make it sense if person says y or n

Here is something nice: :: denotes a comment.

There are two ways.
1. One command only
2. Multiple commands

Code:

ECHO Blah blah blah? [Y/N]
SET /P VarName=
IF %VarName% == Y ::Command here
IF %VarName% == N ::Command here

Code:

ECHO Blah blah blah? [Y/N]
SET /P VarName=
IF %VarName% == Y GOTO YEAH
IF %VarName% == N GOTO NOPE

:YEAH
::Commands here

:NOPE
::Commands here

WOW! YOU ARE THE BEST SCRATCHER EVER! THANKYOU THANKYOU THANKYOU!

Last edited by TornFusion (2011-05-21 12:45:07)

Offline

 

#9 2011-05-21 12:35:32

ThePCKid
Scratcher
Registered: 2009-09-16
Posts: 1000+

Re: .bat help!

TornFusion wrote:

ThePCKid wrote:

TornFusion wrote:

thanks! Now, how can i make it sense if person says y or n

Here is something nice: :: denotes a comment.

There are two ways.
1. One command only
2. Multiple commands

Code:

ECHO Blah blah blah? [Y/N]
SET /P VarName=
IF %VarName% == Y ::Command here
IF %VarName% == N ::Command here

Code:

ECHO Blah blah blah? [Y/N]
SET /P VarName=
IF %VarName% == Y GOTO YEAH
IF %VarName% == N GOTO NOPE

:YEAH
::Commands here

:NOPE
::Commands here

WOW! YOU ARE THE BEST SCRATCHER EVER! THANKYOU THANKYOU THANKYOU!

You're welcome.
Also, I screwed up. rem denotes comments, :: is glitchier.

Offline

 

#10 2011-05-21 12:45:41

TornFusion
Scratcher
Registered: 2010-09-03
Posts: 1000+

Re: .bat help!

By the way, can you add to a variable, like set a variable to 0, and later on, add 1 to it?

Offline

 

#11 2011-05-21 12:46:09

ThePCKid
Scratcher
Registered: 2009-09-16
Posts: 1000+

Re: .bat help!

TornFusion wrote:

ThePCKid wrote:

TornFusion wrote:

thanks! Now, how can i make it sense if person says y or n

Here is something nice: :: denotes a comment.

There are two ways.
1. One command only
2. Multiple commands

Code:

ECHO Blah blah blah? [Y/N]
SET /P VarName=
IF %VarName% == Y ::Command here
IF %VarName% == N ::Command here

Code:

ECHO Blah blah blah? [Y/N]
SET /P VarName=
IF %VarName% == Y GOTO YEAH
IF %VarName% == N GOTO NOPE

:YEAH
::Commands here

:NOPE
::Commands here

WOW! YOU ARE THE BEST SCRATCHER EVER! THANKYOU THANKYOU THANKYOU!

Even better for muliple commands:

Code:

ECHO Blah blah blah? [Y/N]
SET /P VarName=
IF %VarName% == Y (
 rem Command 1
 rem Command 2
 rem Etc...
)
IF %VarName% == N (
 rem Command 1
 rem Command 2
 rem Etc...
)

Offline

 

#12 2011-05-21 13:00:25

TornFusion
Scratcher
Registered: 2010-09-03
Posts: 1000+

Re: .bat help!

Now how do you rename files on w7?

Offline

 

#13 2011-05-21 13:04:07

TornFusion
Scratcher
Registered: 2010-09-03
Posts: 1000+

Re: .bat help!

Neow... HELP!

Offline

 

#14 2011-05-21 13:04:45

ThePCKid
Scratcher
Registered: 2009-09-16
Posts: 1000+

Re: .bat help!

TornFusion wrote:

Now how do you rename files on w7?

Code:

REN <old name> <new name>
RENAME <old name> <new name>

Both do the same thing.

Last edited by ThePCKid (2011-05-21 13:05:11)

Offline

 

Board footer