Expected Identifier Error In Vbscript
Contents |
that is not a VBScript reserved microsoft vbscript compilation error '800a0401' expected end of statement word). Enclose the reserved word in [ ].
Need Help about VBScript? Download VbsEdit! This package includes VbsEdit 32-bit, VbsEdit 64-bit, HtaEdit 32-bit and HtaEdit 64-bit.The evaluation version never expires. Home Copyright © 2001-2016 Adersofthere for a quick overview of the site Help Center Detailed answers to any questions you might have vbs expected end of statement 800a0401 Meta Discuss the workings and policies of this site About Us Learn vbscript compilation error expected statement more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us microsoft vbscript compilation error '800a0400' expected statement Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like http://www.vbsedit.com/html/39750918-5a76-4329-aa39-8026df529487.asp you, helping each other. Join them; it only takes a minute: Sign up vbscript : unexpected identifier up vote 0 down vote favorite In my code I get the following error message c:\dpdata_copy2.vbs(114,13) Microsoft VBScript compilation error: Expected identifier line 114 points to a blank line so I assuemd it was throwing an error at the http://stackoverflow.com/questions/480533/vbscript-unexpected-identifier following line: Lastprop = f.DateLastModified in the code strComputer = "." Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") strFolderName = "D:\1\production\Openjobs" Set colSubfolders = objWMIService.ExecQuery _ ("Associators of {Win32_Directory.Name='" & strFolderName & "'} " _ & "Where AssocClass = Win32_Subdirectory " _ & "ResultRole = PartComponent") 'variables for getting last accessed property Dim fs, f Set fs = CreateObject("Scripting.FileSystemObject") For Each objFolder in colSubfolders 'get last modified date Set f = fs.GetFolder(objFolder.Name) Lastprop = f.DateLastModified 'MsgBox(Lastprop) if ( DateDiff("m", f.DateLastModified, Now()) > 4) then diffindates = DateDiff("m", f.DateLastModified, Now()) Set objShell = CreateObject("Shell.Application") Set objCopyFolder = objShell.NameSpace(ParentFolder) OutputToLog("rem " & f.DateLastModified & ":" & objFolder.Name ) outputtolog("move /Y """ & objFolder.Name & """ " & ParentFolder) wscript.echo(diffindates & ":" & objFolder.Name & vbCr) end if Next Any ideas? or should I post the entire script up? vbscript share|improve this question edited Jan 26 '09 at 18:17 Patrick Cuff 18.4k74984 asked Jan 26 '09 at 17:08 phill 3,6752885127 What's objFolder? Does it have a value fo
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack http://stackoverflow.com/questions/13843981/expected-identifier-code-error-when-running-script Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community http://www.codingforums.com/asp/80765-expected-identifier-error.html of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Expected Identifier Code Error when running script? up vote -4 down vote favorite 1 I got this vbscript compilation script off the technet website, but I get an error when I try to execute it on my Windows 7 machine. I am completely new to scripting, but I wonder if this was made for an older OS and needs a bit of changing for Windows 7? I'm quite sure the guy who wrote it up tested it. I get the Windows Script Host Error as follows: Line: 1 Char: 10 vbscript compilation error Error: Expected Identifier Code: 800A03F2 Source: Microsoft VBScript compilation error. Here's the script: Function New-BackUpFolder($destinationFolder) { $dte = get-date $dte = $dte.tostring() -replace "[:\s/]", "." $backUpPath = "$destinationFolder" + $dte $null = New-Item -path $backUpPath -itemType directory New-Backup $dataFolder $backUpPath $backUpInterval } #end New-BackUpFolder Function New-Backup($dataFolder,$backUpPath,$backUpInterval) { "backing up $dataFolder... check $backUppath for your files" Get-Childitem -path $dataFolder -recurse | Where-Object { $_.LastWriteTime -ge (get-date).addDays(-$backUpInterval) } | Foreach-Object { copy-item -path $_.FullName -destination $backUpPath -force } } #end New-BackUp # *** entry point to script *** $backUpInterval = 1 $dataFolder = "C:\fso" $destinationFolder = "C:\BU\" New-BackupFolder $destinationFolder windows-7 vbscript copy backup share|improve this question edited Dec 12 '12 at 19:58 asked Dec 12 '12 at 16:16 user1898410 11 3 What have you tried? –thegrinner Dec 12 '12 at 16:40 Looking at line: 1, char: 10, I would guess that 'New' is a protected word. Try changing the names of the methods to not be prefixed with 'New-'. –dma Dec 12 '12 at 16:41 Please revise your subject line so the question will be useful to future visitors to the site. Otherwise, it is "too localized". –Raymond Chen Dec 12 '12 at 17:20 add a comment| 1 Answer 1 active oldest votes up vote 1 down vote that's ac
New? Today's Posts FAQ Rules Guidelines Search Advanced Search Forum :: Server side development ASP Expected identifier Error If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. Enjoy an ad free experience by logging in. Not a member yet? Register. Results 1 to 2 of 2 Thread: Expected identifier Error Thread Tools Show Printable Version Email this Page… Subscribe to this Thread… Rate This Thread Current Rating Excellent Good Average Bad Terrible 02-27-2006,08:53 PM #1 DigitalFusion View Profile View Forum Posts New Coder Join Date Jan 2006 Posts 33 Thanks 2 Thanked 0 Times in 0 Posts Expected identifier Error Ok, I cant figure this out, and I am sure it is somethign stupid cause I am over tired. I am getting this error: Error Type: Microsoft VBScript compilation (0x800A03F2) Expected identifier /intranet/sales_cservice/ezpricer/pricerfunctions.asp, line 3, column 4 Sub Currency(str) ---^ This is the sub: Sub Currency(str) if str <>"" then str = FormatCurrency(str,2) End Sub What am I missing here? Reply With Quote 02-27-2006,09:09 PM #2 Brandoe85 View Profile View Forum Posts teh Moderatorinator Join Date Sep 2004 Location USA Posts 2,472 Thanks 4 Thanked 40 Times in 40 Posts Currency is more than likely a reserved word and you cannot use it's name. you also need to put your if statement on one line if you're not going to put an end if, I also think you want to use a function instead and return the value: Code: Function NewName(str) if str <>"" then str = FormatCurrency(str,2) end if NewName = str End Function ' or if you want to use a one-liner Function NewName(str) if str <>"" then str = FormatCurrency(str,2) NewName = str End Function Good luck; -Brando Why using tables for eating is stupid! Reply With Quote « Previous Thread | Next Thread » Posting Permissions You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On [VIDEO] code is On HTML code is Off Forum Rules Sponsored Ads -- Green Fluid (In Use) -- Default Mobile Style CodingForums.com Archive Top All times are GMT +1. The time now is 11:44 AM. Powered by vBulletinCopyright ©2000 - 2016, Jelsoft Enterprises Ltd.