News:
|
dir /x
:: lfn2dos.bat
:: ===========
:: Example -> stdout
:: -----------------
:: lfn2dos -> (nothing)
:: lfn2dos "C:\Documents and Settings\All Users\Application Data\Microsoft\Media Player\UserMigratedStore_59R.bin" -> (olddos path)
:: lfn2dos . -> (olddos path of current directory)
:: Redirection
:: -----------
:: Redirection of output is of course possible, e.g.: lfn2dos . > c:\text\olddospath.txt
@for %%I in (%1) do @echo vollstaendig %%~sI
@for %%I in (%1) do @echo original %%~fI
@for %%I in (%1) do @echo Pfad %%~dI%%~psI
@for %%I in (%1) do @echo Dateiname %%~nsI
:: @for %%I in (%1) do @echo %%~dI%%~psI
|
|
static void Main(string[] args)
{
string copyFrom = "CodeKicker.exe";
string copyTo = "CodeKicker123.exe";
System.IO.File.Copy(copyFrom, copyTo);
if (System.IO.File.Exists(copyTo))
{
Console.WriteLine("ok");
}
else
{
Console.WriteLine("Fehler");
}
Console.ReadLine();
}
|
System.IO.File.Copy(@"D:\Temp\CodeKicker123.exe", @"D:\Temp\Testverzeichnis\CodeKicker123.exe");
System.IO.File.Copy(@"D:\Temp\CodeKicker123.exe", @"D:\Temp\Testverzeichnis\CodeKicker123.exe", true);
|
private static void CopyDll(string file)
{
//Prüfen, ob der Zielordner existiert, falls nicht,
//wird ein Ordner erstellt.
if (!(Directory.Exists(CopiedDlls)))
{
Directory.CreateDirectory(CopiedDlls);
}
string sourceFile = Path.Combine(DllsToCopyPath, file);
string destFile = Path.Combine(CopiedDlls, file);
//Kopieren der Datei
//Überschreiben der Datei, falls sie schon existiert
File.Copy(sourceFile, destFile, true);
}
|
1 |
Wenn es an der Methode Path.Combine liegen sollte, dann schau die doch mal die strings sourceFile und destFile an, wenn du sie erzeugt hast.
– KN 02.04.2012
|
|
Poste mal bitte die Werte der Konstanten DllsToCopyPath sowie CopiedDlls. Sicherlich vermurkst Path.Combine da irgendwas, da Path.Combine sehr strikt vorgeht.
– mkernbach 02.04.2012
|
|
Also falls den Link zu Microsoft meinst: So leicht geht das ja nicht, da ich ja das Programm auch auf anderen Rechnern einsetzen will ...
– starki 05.04.2012
|