日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

用命令行CMD .bat 相关操作 如: 创建快捷方式 复制文件等

發(fā)布時間:2025/3/15 编程问答 24 豆豆
生活随笔 收集整理的這篇文章主要介紹了 用命令行CMD .bat 相关操作 如: 创建快捷方式 复制文件等 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

?1,創(chuàng)建快捷方式:

1, download:http://optimumx.com/download/Shortcut.zip?

or?http://files.cnblogs.com/netact/Shortcut.zip

解壓文件到你的目錄 (for example). Now, suppose you want to create a shortcut for a file called scrum.pdf (also on desktop):

1. open CMD and go to desktop folder
2. run:?Shortcut.exe /f:"%USERPROFILE%\Desktop\sc.lnk" /a:c /t:%USERPROFILE%\Desktop\scrum.pdf

it will create a shortcut called sc.lnk on your desktop that will point to the original file (scrum.pdf)

?

第二種方式:

我的用法:

@echo off
set CurrentDir=%cd%
set Source=nircmd.exe
set sfile=%cd%\%Source%
nircmd.exe shortcut "%sfile%" "~$folder.desktop$" "NirCmd"

?

http://nircmd.nirsoft.net/shortcut.html

NirCmd Command Reference - shortcut shortcut [filename] [folder] [shortcut title] {arguments} {icon file} {icon resource number} {ShowCmd} {Start In Folder} {Hot Key} Creates a shortcut to a file. The parameters: [filename]: Create a shortcut to this filename. [folder]: Specify the destination folder that inside it the shortcut will be created. You can specify any valid folder, including the special variables that represent system folders, like ~$folder.desktop$ (Desktop folder), ~$folder.programs$ (Start-Menu-Programs folder), and so on... [shortcut title]: The text displayed in the shortcut. {arguments}: Optional parameter - Additional arguments to execute the filename. {icon file}: Optional parameter - Use this parameter if your want that the shortcut will be displayed with icon other than the default one. {icon resource number}: Optional parameter - The resource number inside the icon file. {ShowCmd}: Optional parameter - Use this parameter if you want to maximize or minimize the window of the program. Specify "max" to maximize the window or "min" to minimize it. {Start In Folder}: Optional parameter - Specifies the "Start In" folder. If you don't specify this parameter, the "Start In" folder is automatically filled with the folder of the program you specify in [filename] parameter. {Hot Key}: Optional parameter - Specifies an hot-key that will activate the shortcut. For example: Alt+Ctrl+A, Alt+Shift+F8, Alt+Ctrl+Shift+Y Examples: nircmd.exe?shortcut "f:\winnt\system32\calc.exe" "~$folder.desktop$" "Windows Calculator" nircmd.exe?shortcut "f:\winnt\system32\calc.exe" "~$folder.programs$\Calculators" "Windows Calculator" nircmd.exe?shortcut "f:\Program Files\KaZaA\Kazaa.exe" "c:\temp\MyShortcuts" "Kazaa" nircmd.exe?shortcut "f:\Program Files" "c:\temp\MyShortcuts" "Program Files Folder" "" "f:\winnt\system32\shell32.dll" 45 nircmd.exe?shortcut "f:\Program Files" "c:\temp\MyShortcuts" "Program Files Folder" "" "" "" "max" 2,編譯.net 項(xiàng)目:

IF "%1"=="" (SET mode=Release) else (SET mode=%1)

cd ../
set ROOT_DIR=%cd%
set MSBUILD="C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe"

IF %mode%==Release (
%MSBUILD% HP.WWSpc.sln /t:Rebuild /P:Configuration=Release /p:PlatformTarget=x86
@Rem ;Platform=x86
)

IF %mode%==Debug (
%MSBUILD% HP.WWSpc.sln /t:Rebuild /P:Configuration=Debug /p:PlatformTarget=x86
@Rem ;Platform=x86
)

3,文件操作:

if exist "Output\" RMDIR /s /q Output\ ? ? ? ?//刪除文件

::ww-spc Explorer @rem make dir ,create folder
mkdir Output\Explorer\
xcopy /y /c /E /k /x Client\bin\%mode%\*.* Output\Explorer\ ? ?//復(fù)制所有文件及子文件和文件夾等


::ww-spc Server
mkdir Output\Server\
xcopy /y /c /E /k /x Server\Host\bin\%mode%\*.* Output\Server\

關(guān)閉程序后,過一段時間,自動重啟程序:
var dr = MessageBox.Show("You have modified the configuration. If you have to restart this application to apply the changes. \r\nClick \"Yes\" to Restart this appplication, Click \"No\" to Continue run this application.", "Configuration changed", MessageBoxButtons.YesNo, MessageBoxIcon.Question);if (dr == DialogResult.Yes){string fname = "RestartApplcation.bat";File.WriteAllText(fname,"ping 1.1.1.1 -n 1 -w 2000 > nul"+Environment.NewLine+ "start \"\" \""+ Application.ExecutablePath +"\"" + Environment.NewLine+ "exit");System.Diagnostics.Process process = new System.Diagnostics.Process();System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;startInfo.FileName = fname;//startInfo.Arguments = "/C ping 1.1.1.1 -n 1 -w 2000 > nul & "+Application.ExecutablePath+ " && exit";process.StartInfo = startInfo;process.Start();Program.server.Close();}

  

轉(zhuǎn)載于:https://www.cnblogs.com/netact/p/3510177.html

總結(jié)

以上是生活随笔為你收集整理的用命令行CMD .bat 相关操作 如: 创建快捷方式 复制文件等的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。