How to use variable in a path that calls a bat file

qatest

New Member
Hi,

I have a requirement where I need to use a variable instead of a full path when I call a bat file.

Example:
var path = "C://xyz/..."
Sys.OleObject("WScript.Shell").Run("cmd /c \"" path + myfile.bat\"");

The above line doesn't seem to work with 'path' variable but works fine when I add the full path.

Can anyone help with this please.

Thanks
 

My Computer

System One

  • Operating System
    Windows
I don't know anything about writing this kind of stuff and am surprised none of our experts are responding but, what happens if you delete the first line and replace "path" in the second line with it?
 

My Computer

System One

  • Operating System
    Vista Home Premium 64 bit SP2
    Manufacturer/Model
    Cyberpower
    CPU
    Intel Quad CPU Q6700 2.67 GHZ
    Motherboard
    NVIDIA 780i
    Memory
    4 GB
    Graphics Card(s)
    MSI GTX 560 TI Twin Frozr
    Sound Card
    Sound Blaster SB Audigy
    Monitor(s) Displays
    Viewsonic VG2436
    Screen Resolution
    1920x1080p
    Hard Drives
    Samsung HD 105SI
    WDC WD20
    Case
    Apevia XJupiter
    Cooling
    air
    Keyboard
    Logitech MX 3200
    Mouse
    Logitech MX 600
    Internet Speed
    30 Mbps
Did you get this resolved?
 

My Computer

System One

  • Operating System
    Vista Home Premium 64 bit SP2
    Manufacturer/Model
    Cyberpower
    CPU
    Intel Quad CPU Q6700 2.67 GHZ
    Motherboard
    NVIDIA 780i
    Memory
    4 GB
    Graphics Card(s)
    MSI GTX 560 TI Twin Frozr
    Sound Card
    Sound Blaster SB Audigy
    Monitor(s) Displays
    Viewsonic VG2436
    Screen Resolution
    1920x1080p
    Hard Drives
    Samsung HD 105SI
    WDC WD20
    Case
    Apevia XJupiter
    Cooling
    air
    Keyboard
    Logitech MX 3200
    Mouse
    Logitech MX 600
    Internet Speed
    30 Mbps
Back
Top