Shell - Passing a mix of variables & text problem.

Posted on 2006-05-09
Last Modified: 2010-05-01
Hi All,

This is probably something fairly simple, but i need it quite urgently so i'm going to award 500 points for and quick reply.

As you can see below I have a shell command with a mix of variables and text. The problem is with the last string bit "\Dropbox /T /E /G AUTHENTICATED USER:RC"
as i need the authenticated user bit to be in speech quotation marks too which VB wont accecpt.

Shell ("Xcacls " + path + user + "\dropbox /T /E /G AUTHENTICATED USERS:RC")

I need to VB to accept the following code, or something that will do the same job.

Shell ("Xcacls " + path + user + "\dropbox /T /E /G "AUTEHNTICATED" USERS:RC")

As you can see VB gets confused with what appears to be nested speech quotation marks, however the command will not work without the speech quotation marks around AUTHENTICATED USERS.

I need this ASAP for I would be grateful for some urgent help, hence awarding 500 points.
Question by:IS_Monkey
    LVL 3

    Expert Comment

    Would this work?

    Shell ("Xcacls " + path + user + """\dropbox /T /E /G AUTHENTICATED USERS:RC""")
    LVL 13

    Expert Comment

    try this
    Shell ("Xcacls " + path + user + "\dropbox /T /E /G" & Chr(34) & "AUTHENTICATED" & Chr(34)  & "USERS:RC")
    LVL 26

    Accepted Solution

    think you need to include the users inside the double quote

    Shell ("Xcacls " & path & user & "\dropbox /T /E /G ""AUTEHNTICATED USERS"":RC")

    Author Comment

    So far EDDYKT is the closest, with his answer expect the AUTHENTICATED USERS bit actually requires 3 double quotes """AUTHENTICATED USERS""" so I will split the points and adward him 250.

    Now the last part of the challenege...............

    When I use xcacls to change authorities Shell ("xcacls " & path & user & "\dropbox /T /E /G ""AUTEHNTICATED USERS"":RC") it wont work, however when i add authorities at a user level it works fine.


    Shell ("Xcacls " & path & user & "\dropbox /T /E /G " & user & ":RC")

    If need be i will award the points and do this as a seprate question.
    LVL 26

    Expert Comment

    may be you want to do that

    Shell Environ("comspec") & " /c xcacls " & path & user & "\dropbox /T /E /G ""AUTEHNTICATED USERS"":RC")

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
    Article by: Martin
    Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
    Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
    This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now