Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
C# literal string command line builtup
Message
 
À
30/03/2006 15:00:01
Evans Carl
System Answers Consulting, Inc
Big Lake, Minnesota, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
C# 1.1
OS:
Windows XP SP2
Network:
Novell 4.x
Database:
MS SQL Server
Divers
Thread ID:
01109283
Message ID:
01109344
Vues:
34
>>
>>string s = "Some text in \"quotes\"";
>>
>>
>>
>>>All,
>>>
>>>I'm trying to create a command line Schedule task with the following code
>>>
>>>strCmdLine = "schtasks /s "+ sComputerName +" /create /U " + sDomainName + " /P " + sDomainPassword + " /SC " + sTime + " /TN " + strJobName + " /TR " + sFTPExecutable + " " + oData.ScheduleId + " /SD " + dtStartDate.ToString("MM/dd/yyyy") + " /ED " + dtEndDate.ToString("MM/dd/yyyy") + " /RU runasuser" + " /RP " + sDomainPassword;
>>>
>>>However I am can not find a way to built up my literal string is get the double quote before the executable and after the Schedule Id, I'm hoping that someone call help me out.
>>>
>>>schtasks /s \\whoisme /create /U WC\cevans /P password /SC WEEKLY /TN tes
>>>tjobname /TR "\"c:\executable.exe 13fd18c1-cfc0-4bf7-8b7c-a2a84e97126d" /SD 03/26/2006 /ED 03/26/2006 /RU runasuser /RP password
>>>
>>>
>>>Evans,
>
>Einar,
>
>I actually need away to also have the "backslash" as part of the string. For example "\"c:\executable.exe 13fd18c1-cfc0-4bf7-8b7c-a2a84e97126d" I used sFTPExecutable as the file name and oData.ScheduleId for guid, but I unable to get the "\" or the preceding single double quote. I have tried a number of ways but I have not been able to successfully the desirable results.
>
>Evans

two backslashes in a string will give you one backslash
string s = "\\-\"backslash\"";
You can read more about this under escape character in the help.

Hope this helps,
Einar
Semper ubi sub ubi.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform