Jump to content


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.

Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.


Use of Shell Function

  • Please log in to reply
2 replies to this topic

#1 jai2k


  • Members
  • 6 posts
  • Local time:02:20 AM

Posted 07 December 2004 - 06:16 AM


I am using Shell function in VB to open the file.
shell(path of the exe,path&filename)

If the filename has spaces in between , I have a problem because the file name is truncated after spaces.hence the error "File not found"

I can't add Quotes "" before the path of the filename because it is a variable.

Can anyone help pls

Thank you

BC AdBot (Login to Remove)


#2 LoLucky


  • Members
  • 331 posts
  • Local time:03:20 AM

Posted 07 December 2004 - 08:57 AM

Might help some to understand What you are looking for if you post your Code
You can use the Code button to post it correctly

As noted above i'm not sure what you are looking for But you can try

Dim File1 As Double 

File1 = Shell(path,vbNormalFocus)

where path is "C:\Program Files\Som Other File With Spaces\File to Topen.exe"

Hope that helps,

Edited by LoLucky, 07 December 2004 - 09:13 AM.

#3 raw


    Bleeping Hacker

  • Members
  • 2,577 posts
  • Gender:Male
  • Location:Texas
  • Local time:02:20 AM

Posted 07 December 2004 - 12:57 PM

location = Chr(34) + "C:\Program Files\My Program\Prog.exe" + Chr(34)

file = Chr(34) + Text1.Text + Chr(34)

Shell location + " " + file, vbNormalFocus


Shell "notepad ""C:\dir with spaces\test.txt""", vbNormalFocus


 rawcreations.net          @raw_creations

Current systems: WHAT OS, BackTrack-raw, PCLinuxOS, Peppermint OS 6, Kali Linux

and a custom Linux From Scratch server hosting a bunch of top secret stuff.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users