Home > Batch Script > Batch Script Error Was Unexpected At This Time

Batch Script Error Was Unexpected At This Time


Join our community for more solutions or to ask questions. When parentheses are used, all the commands and variables within those parentheses are expanded. On THE other hand or on another hand? But when I put this in a .bat script it throws me an error saying do ( was unexpected at this time. this contact form

echo 3.~Yet to come~. set "a=%globalparam1%" goto :aCheck :aPrompt set /p "a=Enter Choice: " :aCheck if not defined a goto :aPrompt echo %a% IF "%a%"=="2" ( title USB WRITE LOCK echo What do you want Not the answer you're looking for? For your understanding, :Fix and :ri do not exist.Also, try this:if [%opt%]==[1] goto Killif [%opt%]==[2] goto Fixif [%opt%]==[3] goto riif [%opt%]==[4] exit Report • Start a discussion Ask Your QuestionEnter more

Batch File Was Unexpected At This Time Error

Such opinions may not be accurate and they are to be used at your own risk. Not the answer you're looking for? This quick video will show you how to change your primary email address. echo 1.Enable/Disable USB Storage Devices.

netstat -a | find "192.145.23.%%i" ) >> "%my-path%%my-file%" If you want a specific format you have give more details. How to handle spending money for extended trip to Europe? Browse other questions tagged windows command-line . Batch Script Time Date Another useful form is set "var=default" set /p var= or set "var=default" set /p "var=[%var%]" (which prompts with the default value; !var!

Thank you!! =) –user2540289 Jul 2 '13 at 6:10 add a comment| up vote 5 down vote Oh, dear. Batch Script Error Handling Top Profile Reply with quote Fawers Post subject: Re: was unexpected at this time???PostPosted: 15 Apr 2012 08:54 Offline Joined: 08 Apr 2012 17:11 Posts: 187 That line:Code:C:\test> IF Operating Systems ▼ Windows 10 Windows 8 Windows 7 Windows XP See More... Two other matters of which you should be aware: First, set/p will assign a user-input value to a variable.

My home country claims I am a dual national of another country, the country in question does not. Batch Script Time Delay echo 3.~Yet to come~. What does the "Phi" sign stand for in musical notation? Here is an interesting discussion about the weird label comment behavior here: dostips.com/forum/viewtopic.php?f=3&t=4204 –David Ruhmann Jul 2 '13 at 13:28 @David Interesting discussion, but I'd reject the idea that

Batch Script Error Handling

How do I need to change it to work directly from the command prompt and NOT require a batch file? Each environment variable assigned in the same command line or block does not expand to the value except you would use EnableDelayedExpansion ...RegardsaGermanYes, a common mistake.Thanks, aGerman. Batch File Was Unexpected At This Time Error Join them; it only takes a minute: Sign up Here's how it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise to the Windows Batch Script Error Handling Also, always set var to undefined before a set /p:set opt=set /p opt=:If XXX Exist (goto Uinstall)mkdir XXXcd XXXECHO INSTALLING!

echo 1.Apply USB Write Protection echo 2.Remove USB Write Protection ::param1 set "param1=%globalparam2%" goto :param1Check :param1Prompt set /p "param1=Enter Choice: " :param1Check if "%param1%"=="" goto :param1Prompt if %param1%==1 ( REG ADD weblink What are the canonical white spaces? You could use an environment variable(setting from "for /f") but you would also have to use delayed expansion. I tried that and then just saw it print out everything after "DO" and didn't think it worked right, but I can then run an ECHO command afterwards and it works Was Unexpected At This Time Batch File For Loop

facility. more stack exchange communities company blog Stack Exchange Inbox Reputation and Badges sign up log in tour help Tour Start here for a quick overview of the site Help Center Detailed Moderator: DosItHelp Post new topic Reply to topic Page 1 of 1 [ 6 posts ] Print view Previous topic | Next topic Author Message tinfanide Post subject: was unexpected http://waspsoft.com/batch-script/batch-script-exit-with-error.html current community chat Stack Overflow Meta Stack Overflow your communities Sign up or log in to customize your list.

Report • #2 chinmaya_07 May 22, 2011 at 20:41:27 thanks man...the batch file works fine now Report • #3 chinmaya_07 May 22, 2011 at 21:37:21 also help me abt Report • Was Unexpected At This Time Command Prompt Yes No What's that? Operating Systems ▼ Windows 10 Windows 8 Windows 7 Windows XP See More...

but note that the second method requires that the var NOT have percents!

All rights reserved. If you have any questions, then please Write a Comment below! just need them in a notepad file as above mentioned Report • #12 Judago May 24, 2011 at 00:42:35 Well if #10 didn't do it for you (the comma could be Was Unexpected At This Time If Exists I have a later command that would echo %ip% to a .txt file.

Yes, I made some assumptions about :END; hard to say without seeing more of the script. –jamesdlin Mar 21 '12 at 10:35 Still not correct - I think it The Woz Monitor My girlfriend has mentioned disowning her 14 y/o transgender daughter Is there a way to make a metal sword resistant to lava? Browse other questions tagged if-statement batch-file cmd or ask your own question. his comment is here Is the following extension of finite state automata studied?

Report • #7 thephantomblu January 4, 2014 at 07:02:04 @adam See this:if %opt%== 2 goto Fixif %opt%== 3 goto riHere, the gotos are not taking it anywhere, because there are no Off-Topic Tags How-tos Drivers Ask a Question Computing.NetForumsProgrammingBatch/Scripting Solved Batch file problem - Goto Was unexpected at this time Tags:open sourceCD-ROM xXAdamXx January 3, 2014 at 07:47:40 Specs: Windows 8,1 Hi I do not get any ether when mining How rich can one single time travelling person actually become? set "a=%globalparam1%" goto :aCheck :aPrompt set /p "a=Enter Choice: " :aCheck if "%a%"=="" goto :aPrompt echo %a% IF %a%==2 ( title USB WRITE LOCK echo What do you want to do?

See More: unexpected error Report • #1 Judago May 19, 2011 at 00:03:31 ✔ Best AnswerChange %i to %%i (Script for variables need two %'s, command prompt only needs one.).Also change: What type of sequences are escape sequences starting with "\033]" Yes, of course I'm an adult! asked 3 years ago viewed 48480 times active 4 months ago Related 641How to pass command line parameters to a batch file?457Batch file to delete files older than N days402Long commands echo %USER_DEF_VAR% cd %USER_DEF_VAR%\topLevelDir for /D %G in ("%USER_DEF_VAR%\topLevelDir\*") do ( cd %G gmake clean gmake ) If I run this script on a command line, it works fine.

My current program looks like this and gives the output below. Any ideas ? View Results Poll Finishes In 6 Days.Discuss in The LoungePoll History About Us | Advertising Info | Privacy Policy | Terms Of Use and Sale | Copyright Policy | Contact Us© It seems like that would be an escapable charactor::mike Report • #3 xXAdamXx January 3, 2014 at 09:59:05 well, @thephantomblu,Im not sure what that means, so, Im just a young person.Please

never use "!" in var. Browse other questions tagged batch-file or ask your own question. Related 15Batch file IF statement fails with “was unexpected at this time”1) was unexpected at this time error1Goto was unexpected at this time batch file5Error: “|” was unexpected at this time asked 3 years ago viewed 7361 times active 7 months ago Linked 0 nested For loop in batch file error: Do was unexpected at this time 0 Windows command works from