Werbung: SecurityConsole.de verwaltet Ihre Computer mit Security Essentails aus der Cloud!
30 Tage kostenfrei testen und 20% Rabatt für Ihre Bestellung mit Promocode: WBF2685582
(Promocode gültig bis 31.12.2011)

Group:  English: Windows Server » microsoft.public.windows.server.scripting
Thread: Variable

HTVi
TV Discussion Newsgroups

Variable
Dee 11/23/2008 6:23:01 PM
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
Re: Variable
Tom Lavedas <tglbatch[ at ]cox.net> 11/23/2008 7:19:09 PM
On Nov 23, 1:23 pm, Dee <D...[ at ]discussions.microsoft.com> wrote:
[Quoted Text]
> 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
==========
Re: Variable
Dee 11/23/2008 10:21:01 PM
Thanks Tom
--
Dee


"Tom Lavedas" wrote:

[Quoted Text]
> On Nov 23, 1:23 pm, Dee <D...[ at ]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
> ==========
>

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net
Suche nach Orten, Städten, Postleitzahlen, Vorwahlen, Kfz-Kennzeichen