-
cd هم زدم فرقی نکرد.
اینم عکس دستور
Get-ChildItem -Recurse *.exe که فقط همون فایل داخل تست رو میشناسه.
[ برای مشاهده لینک ، با نام کاربری خود وارد شوید یا ثبت نام کنید ]
تغییر مسیر هم تفاوتی ایجاد نکرد.
اینم پیغام دستور whatif
کد:
What if: Performing operation "Rename File" on Target "Item: G:\Documents and Settings\Documents\Downloads\test\BRU_Setu
p_WinNTx86.exe Destination: G:\Documents and Settings\Documents\Downloads\test\BRU_Setup_WinNTx86SALAM.exe".
PS G:\Documents and Settings\Documents\Downloads\test>
-
سلام
اینم تست خودمه:
کد:
PS C:\VM\1> ls
Directory: C:\VM\1
Mode LastWriteTime Length Name
---- ------------- ------ ----
d---- 01-Feb-14 12:20 AM A
d---- 01-Feb-14 12:20 AM B
d---- 01-Feb-14 12:20 AM C
d---- 01-Feb-14 12:20 AM D
-a--- 01-Feb-14 12:20 AM 0 11.exe
-a--- 01-Feb-14 12:19 AM 0 22.exe
-a--- 01-Feb-14 12:19 AM 0 33.exe
-a--- 01-Feb-14 12:20 AM 0 44.exe
PS C:\VM\1> Get-ChildItem -Recurse *.exe
Directory: C:\VM\1\A
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 01-Feb-14 12:20 AM 0 11.exe
-a--- 01-Feb-14 12:19 AM 0 22.exe
-a--- 01-Feb-14 12:19 AM 0 33.exe
-a--- 01-Feb-14 12:20 AM 0 44.exe
Directory: C:\VM\1\B
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 01-Feb-14 12:20 AM 0 55.exe
-a--- 01-Feb-14 12:20 AM 0 66.exe
-a--- 01-Feb-14 12:19 AM 0 77.exe
-a--- 01-Feb-14 12:20 AM 0 88.exe
-a--- 01-Feb-14 12:19 AM 0 99.exe
Directory: C:\VM\1\C
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 01-Feb-14 12:20 AM 0 11.exe
-a--- 01-Feb-14 12:19 AM 0 22.exe
-a--- 01-Feb-14 12:19 AM 0 33.exe
-a--- 01-Feb-14 12:20 AM 0 44.exe
Directory: C:\VM\1\D
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 01-Feb-14 12:20 AM 0 11.exe
-a--- 01-Feb-14 12:19 AM 0 22.exe
-a--- 01-Feb-14 12:19 AM 0 33.exe
-a--- 01-Feb-14 12:20 AM 0 44.exe
Directory: C:\VM\1
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 01-Feb-14 12:20 AM 0 11.exe
-a--- 01-Feb-14 12:19 AM 0 22.exe
-a--- 01-Feb-14 12:19 AM 0 33.exe
-a--- 01-Feb-14 12:20 AM 0 44.exe
و بعد که whatif زدم:
کد:
PS C:\VM\1> Get-ChildItem -Recurse *.exe | ren -n {$_.name -replace ”.exe“,”SALAM.exe”} -whatif
What if: Performing the operation "Rename File" on target "Item: C:\VM\1\A\11.exe Destination: C:\VM\1\A\11SALAM.exe".
What if: Performing the operation "Rename File" on target "Item: C:\VM\1\A\22.exe Destination: C:\VM\1\A\22SALAM.exe".
What if: Performing the operation "Rename File" on target "Item: C:\VM\1\A\33.exe Destination: C:\VM\1\A\33SALAM.exe".
What if: Performing the operation "Rename File" on target "Item: C:\VM\1\A\44.exe Destination: C:\VM\1\A\44SALAM.exe".
What if: Performing the operation "Rename File" on target "Item: C:\VM\1\B\55.exe Destination: C:\VM\1\B\55SALAM.exe".
What if: Performing the operation "Rename File" on target "Item: C:\VM\1\B\66.exe Destination: C:\VM\1\B\66SALAM.exe".
What if: Performing the operation "Rename File" on target "Item: C:\VM\1\B\77.exe Destination: C:\VM\1\B\77SALAM.exe".
What if: Performing the operation "Rename File" on target "Item: C:\VM\1\B\88.exe Destination: C:\VM\1\B\88SALAM.exe".
What if: Performing the operation "Rename File" on target "Item: C:\VM\1\B\99.exe Destination: C:\VM\1\B\99SALAM.exe".
What if: Performing the operation "Rename File" on target "Item: C:\VM\1\C\11.exe Destination: C:\VM\1\C\11SALAM.exe".
What if: Performing the operation "Rename File" on target "Item: C:\VM\1\C\22.exe Destination: C:\VM\1\C\22SALAM.exe".
What if: Performing the operation "Rename File" on target "Item: C:\VM\1\C\33.exe Destination: C:\VM\1\C\33SALAM.exe".
What if: Performing the operation "Rename File" on target "Item: C:\VM\1\C\44.exe Destination: C:\VM\1\C\44SALAM.exe".
What if: Performing the operation "Rename File" on target "Item: C:\VM\1\D\11.exe Destination: C:\VM\1\D\11SALAM.exe".
What if: Performing the operation "Rename File" on target "Item: C:\VM\1\D\22.exe Destination: C:\VM\1\D\22SALAM.exe".
What if: Performing the operation "Rename File" on target "Item: C:\VM\1\D\33.exe Destination: C:\VM\1\D\33SALAM.exe".
What if: Performing the operation "Rename File" on target "Item: C:\VM\1\D\44.exe Destination: C:\VM\1\D\44SALAM.exe".
What if: Performing the operation "Rename File" on target "Item: C:\VM\1\11.exe Destination: C:\VM\1\11SALAM.exe".
What if: Performing the operation "Rename File" on target "Item: C:\VM\1\22.exe Destination: C:\VM\1\22SALAM.exe".
What if: Performing the operation "Rename File" on target "Item: C:\VM\1\33.exe Destination: C:\VM\1\33SALAM.exe".
What if: Performing the operation "Rename File" on target "Item: C:\VM\1\44.exe Destination: C:\VM\1\44SALAM.exe".
ببینید کلا این کاری که میکنه اینه که یه مسیری رو محتویاتش رو ازش لیست میگیره و همه ی اونا رو اونجوری که تعیرف کنید اسمشون رو عوض میکنه.
فقط تنها چیزی که میمونه اینه که مثلا شاید به اون مسیر دسترسی نداره.
اون عکسی که گذاشتید رو دیدم ولی غیر ممکنه؛ چون توی عکس قبلی که گذاشتید چندتا پوشه دیگه هم بود ولی توی خروجی این دستور که زدید حتی اسم اونا رو هم نشون نداده؛ چه برسه به محتویاتشون.
چیز دیگه ای نداره مسیر رو دوباره عوض کنید و دوباره امتحان کنید