Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Server > Scripting > Variable

Reply
 
 
Dee
Guest
Posts: n/a

 
      11-23-2008
I'm trying to add a string to a number

example

number= "12345"

I now want to add the below
DD_

So it looks like this

DD_1234

When i run a msgbox, its fine
msgbox "DD_"&number

but when I run a command like

WShell.run "%COMSPEC% /C dir >> c:\temp\DD_"&"number"

I get c:\temp\DD_number

And not the actual number I want, it should be DD_12345

Any thoughts
(Still newish to vb scripting)

--
Dee
 
Reply With Quote
 
 
 
 
Dee
Guest
Posts: n/a

 
      11-23-2008
Thanks Tom
--
Dee


"Tom Lavedas" wrote:

> On Nov 23, 1:23 pm, Dee <D...@discussions.microsoft.com> wrote:
> > I'm trying to add a string to a number
> >
> > example
> >
> > number= "12345"
> >
> > I now want to add the below
> > DD_
> >
> > So it looks like this
> >
> > DD_1234
> >
> > When i run a msgbox, its fine
> > msgbox "DD_"&number
> >
> > but when I run a command like
> >
> > WShell.run "%COMSPEC% /C dir >> c:\temp\DD_"&"number"
> >
> > I get c:\temp\DD_number
> >
> > And not the actual number I want, it should be DD_12345
> >
> > Any thoughts
> > (Still newish to vb scripting)
> >
> > --
> > Dee

>
> When you put quotes around the variable's name, it becomes a literal
> string. Try this instead ...
>
> WShell.run "%COMSPEC% /C dir >> c:\temp\DD_"& number
>
> Tom Lavedas
> ==========
>

 
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
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
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
OU name to variable Murphy Scripting 6 11-08-2004 07:09 PM
OU name to variable Murphy Scripting 0 11-01-2004 01:00 PM
UO to variable Murphy Scripting 0 11-01-2004 12:59 PM
UO to variable Murphy Scripting 0 11-01-2004 12:54 PM
Variable Fan Scripting 1 10-01-2003 02:36 AM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59