コンソール アプリケーションへの自動エスケープを使用して入力文字列を提供するにはどうすればよいですか?
つまり、コード内でできることです
public static void main(string[] args)
{
string myURL;
myFolder = @"C:\temp\january\"; //just for testing
myFolder = args[0]; // I want to do this eventually
}
コマンドラインから手動でエスケープせずに myFolder に値を提供するにはどうすればよいですか?
可能であれば、このアプリを次のように呼び出すことは避けたいです。
C:\test> myapplication.exe "C:\\temp\\january\\"
編集:代わりに、可能であればこのようにアプリを呼び出すことをお勧めします
C:\test> myapplication.exe @"C:\temp\january\"
ありがとうございました。
編集:
これは実際には、Sharepoint Web サービスを呼び出すコンソール アプリケーション用です。私は試した
string SourceFileFullPath, SourceFileName, DestinationFolder, DestinationFullPath;
//This part didn't work. Got Microsoft.SharePoint.SoapServer.SoapServerException
//SourceFileFullPath = args[0]; // C:\temp\xyz.pdf
//SourceFileName = args[1]; // xyz.pdf
//DestinationFolder = args[2]; // "http://myserver/ClientX/Performance" Reports
//This worked.
SourceFileFullPath = @"C:\temp\TestDoc2.txt";
SourceFileName = @"TestDoc2.txt";
DestinationFolder = @"http://myserver/ClientX/Performance Reports";
DestinationFullPath = string.Format("{0}/{1}", DestinationFolder, SourceFileName);