|
-
Feb 28th, 2007, 02:00 PM
#1
Thread Starter
Lively Member
How to use directory names with spaces with shell?
I'm trying to use a directory with shell that has spaces in it.
I tried setting the directory path to a string but that didn't help. To use quotes in the Windows Command Line I heard you have to use \ (as it's already inside quotes).
Using "shell cmd blahblah\\"blah blah\"" won't work.
Any help or ideas would be greatly appreciated. Also if I'm not making sense please just say
-
Feb 28th, 2007, 02:04 PM
#2
Re: How to use directory names with spaces with shell?
vb Code:
Shell "explorer ""C:\Test Folder\"""
edit: i.e. replace " with ""
-
Feb 28th, 2007, 03:14 PM
#3
Thread Starter
Lively Member
Re: How to use directory names with spaces with shell?
/that gives me a syntax error. This is currently what I'm trying:
Code:
Shell ("cmd.exe /k "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\""Session Manager"" /v blahblah /t REG_MULTI_SZ /d " + meh + file), vbNormalFocus
-
Feb 28th, 2007, 03:39 PM
#4
Re: How to use directory names with spaces with shell?
Shell ("cmd.exe /k ""HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager"" /v blahblah /t REG_MULTI_SZ /d " + meh + file), vbNormalFocus
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.
Please Help Us To Save Ana
-
Feb 28th, 2007, 04:09 PM
#5
Re: How to use directory names with spaces with shell?
Try using ShellExecute instead as its more powerful and doesnt have th space issue.
vb Code:
Option Explicit
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" ( _
ByVal hwnd As Long, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long
Private Const SW_HIDE As Long = 0
Private Const SW_SHOWNORMAL As Long = 1
Private Const SW_SHOWMAXIMIZED As Long = 3
Private Const SW_SHOWMINIMIZED As Long = 2
Private Sub Command1_Click()
ShellExecute Me.hwnd, "Open", "cmd.exe", "/k HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager /v blahblah /t REG_MULTI_SZ /d " + meh + file, "C:\", SW_SHOWNORMAL
End Sub
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|