?
Solved

Create a batch file to save folder to specific location and create a shortcut

Posted on 2011-10-31
5
Medium Priority
?
633 Views
Last Modified: 2012-05-12
Hi.

Does anyone know how to create a batch file, that will copy a folder from the C drive to C:Windows\System32.  Then I would like it to create a shortcut of am RDP connection to the desktop, and change the icon of this shortcut to one located in the folder (now residing in System32 folder).

Any clues on how to do this?
0
Comment
Question by:Jasmin01
5 Comments
 
LVL 23

Expert Comment

by:Danny Child
ID: 37056999
Could we have some more information on your problem, please?

It sounds to me like you want each PC to make it's own RDP icon, which you want to store in a folder inside System32.

is that correct?

If so, the first challenge is creating a custom RDP file.

Will you be storing passwords inside the RDP file - if so, be careful, they're crackable!
http://www.remkoweijnen.nl/blog/2007/10/18/how-rdp-passwords-are-encrypted/

If it's just copying a pre-configured file from one location to another, that's much easier!  please advise...
0
 
LVL 7

Expert Comment

by:Rahul_Gade
ID: 37057436
Is this something you were looking for :

rem copy contents of C:\TeamPhoto\Photo to System32
xcopy /E /I /Y "C:\TeamPhoto\Photo\." "%SystemRoot%\System32\Photo\."

rem generate the rdp.rdp in system32 directory
echo screen mode id:i:1 	>%SystemRoot%\System32\rdp.rdp
echo use multimon:i:0		>>%SystemRoot%\System32\rdp.rdp
echo desktopwidth:i:1024		>>%SystemRoot%\System32\rdp.rdp
echo desktopheight:i:768		>>%SystemRoot%\System32\rdp.rdp
echo session bpp:i:32		>>%SystemRoot%\System32\rdp.rdp
echo winposstr:s:0,3,52,21,852,621	>>%SystemRoot%\System32\rdp.rdp
echo compression:i:1			>>%SystemRoot%\System32\rdp.rdp
echo keyboardhook:i:2		>>%SystemRoot%\System32\rdp.rdp
echo audiocapturemode:i:0		>>%SystemRoot%\System32\rdp.rdp
echo videoplaybackmode:i:1		>>%SystemRoot%\System32\rdp.rdp
echo connection type:i:2		>>%SystemRoot%\System32\rdp.rdp
echo displayconnectionbar:i:1	>>%SystemRoot%\System32\rdp.rdp
echo disable wallpaper:i:1		>>%SystemRoot%\System32\rdp.rdp
echo allow font smoothing:i:0	>>%SystemRoot%\System32\rdp.rdp
echo allow desktop composition:i:0	>>%SystemRoot%\System32\rdp.rdp
echo disable full window drag:i:1	>>%SystemRoot%\System32\rdp.rdp
echo disable menu anims:i:1		>>%SystemRoot%\System32\rdp.rdp
echo disable themes:i:0		>>%SystemRoot%\System32\rdp.rdp
echo disable cursor setting:i:0	>>%SystemRoot%\System32\rdp.rdp
echo bitmapcachepersistenable:i:1	>>%SystemRoot%\System32\rdp.rdp
echo full address:s:193.71.55.160	>>%SystemRoot%\System32\rdp.rdp
echo audiomode:i:0			>>%SystemRoot%\System32\rdp.rdp
echo redirectprinters:i:1		>>%SystemRoot%\System32\rdp.rdp
echo redirectcomports:i:0		>>%SystemRoot%\System32\rdp.rdp
echo redirectsmartcards:i:1		>>%SystemRoot%\System32\rdp.rdp
echo redirectclipboard:i:1		>>%SystemRoot%\System32\rdp.rdp
echo redirectposdevices:i:0		>>%SystemRoot%\System32\rdp.rdp
echo redirectdirectx:i:1		>>%SystemRoot%\System32\rdp.rdp
echo autoreconnection enabled:i:1	>>%SystemRoot%\System32\rdp.rdp
echo authentication level:i:0	>>%SystemRoot%\System32\rdp.rdp
echo prompt for credentials:i:0	>>%SystemRoot%\System32\rdp.rdp
echo negotiate security layer:i:1	>>%SystemRoot%\System32\rdp.rdp
echo remoteapplicationmode:i:0	>>%SystemRoot%\System32\rdp.rdp
echo alternate shell:s:		>>%SystemRoot%\System32\rdp.rdp
echo shell working directory:s:	>>%SystemRoot%\System32\rdp.rdp
echo gatewayhostname:s:		>>%SystemRoot%\System32\rdp.rdp
echo gatewayusagemethod:i:4		>>%SystemRoot%\System32\rdp.rdp
echo gatewaycredentialssource:i:4	>>%SystemRoot%\System32\rdp.rdp
echo gatewayprofileusagemethod:i:0	>>%SystemRoot%\System32\rdp.rdp
echo promptcredentialonce:i:1	>>%SystemRoot%\System32\rdp.rdp
echo use redirection server name:i:0	>>%SystemRoot%\System32\rdp.rdp
echo username:s:rahul		>>%SystemRoot%\System32\rdp.rdp

rem generate the SC.url shortcut file on current users desktop
echo [InternetShortcut] > "%USERPROFILE%\desktop\SC.url"
echo URL=%SystemRoot%\System32\rdp.rdp >> "%USERPROFILE%\desktop\SC.url"
echo IconIndex=1 >> "%USERPROFILE%\desktop\SC.url"
echo IconFile=c:\windows\test.ico >> "%USERPROFILE%\desktop\SC.url"

Open in new window



-Rahul
0
 

Author Comment

by:Jasmin01
ID: 37061456
Thanks Rahul.

I have the follwing code already:  It gives me an error saying : Parameter Format not correct - Access is denied. Input Error: Can not find the script file "C:\Users\User~1\Appdata\Local\Temp\makelink.vbs".

any ideas what is going wrong?

@echo off

REM Change this by remming out desktop or all users desktop as you wish
REM Make sure that all entries below have " " around them as present

rem set Location="AllUsersDesktop"
set Location="Desktop"

set DisplayName="My Shortcut"
set filename="C:\TestFolder\Application.rdp"

REM point to an ICO file or an icon within an existing EXE
rem set icon="C:\TestFolderSetIcon.ico"
set icon="C:\TestFolder\SetIcon.ico, 0"

set WorkingDir="c:\TestFolder"

(echo screen mode id:i:1
echo use multimon:i:0
echo desktopwidth:i:1366
echo desktopheight:i:768
echo session bpp:i:32
echo winposstr:s:0,1,4,0,1353,728
echo compression:i:1
echo keyboardhook:i:2
echo audiocapturemode:i:0
echo videoplaybackmode:i:1
echo connection type:i:2
echo displayconnectionbar:i:1
echo disable wallpaper:i:1
echo allow font smoothing:i:0
echo allow desktop composition:i:0
echo disable full window drag:i:1
echo disable menu anims:i:1
echo disable themes:i:0
echo disable cursor setting:i:0
echo bitmapcachepersistenable:i:1
echo full address:s:192.0.0.0
echo audiomode:i:0
echo redirectprinters:i:0
echo redirectcomports:i:0
echo redirectsmartcards:i:1
echo redirectclipboard:i:0
echo redirectposdevices:i:0
echo redirectdirectx:i:1
echo autoreconnection enabled:i:1
echo authentication level:i:2
echo prompt for credentials:i:0
echo negotiate security layer:i:1
echo remoteapplicationmode:i:0
echo alternate shell:s:MyApplication.exe
echo shell working directory:s:c:\Program Files\ffm\
echo gatewayhostname:s:
echo gatewayusagemethod:i:4
echo gatewaycredentialssource:i:4
echo gatewayprofileusagemethod:i:0
echo promptcredentialonce:i:1
echo use redirection server name:i:0
echo drivestoredirect:s:
) > %filename%
attrib "%filename% +r


REM Make temporary VBS file to create shortcut
REM Then execute and delete it

(echo Dim DisplayName,Location,Path,shell,link
echo Set shell = CreateObject^("WScript.shell"^)
echo path = shell.SpecialFolders^(%Location%^)
echo Set link = shell.CreateShortcut^(path ^& "\" ^& %DisplayName% ^& ".lnk"^)

echo link.Description = %DisplayName%
echo link.TargetPath = %filename%

echo link.WindowStyle = 3
echo link.IconLocation = %icon%

echo link.WorkingDirectory = %WorkingDir%
echo link.Save

)> "%temp%\makelink.vbs"
cscript //nologo "%temp%\makelink.vbs"
del "%temp%\makelink.vbs" 2>NUL

0
 
LVL 1

Accepted Solution

by:
bachcottage earned 1500 total points
ID: 37063829
My question would be why copy to System32 folder?  To get those RDP's in the PATH?  If so, have you considered changing the PATH environmental variable?
0
 

Author Closing Comment

by:Jasmin01
ID: 37151860
Thanks.  I got is sorted with your help.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup" or a blinking cursor with black screen. A loop for Auto repair will start but fix nothing.  You will be panic as there are no back…
Assume you have an outside contractor who comes in seasonally or once a week to do some work in your office, but you only want to give him access to the programs and files he needs and keep all other documents and programs private. Can you do this o…
In this Micro Tutorial viewers will learn how to use Boot Corrector from Paragon Rescue Kit Free to identify and fix the boot problems of Windows 7/8/2012R2 etc. As an example is used Windows 2012R2 which lost its active partition flag (often happen…
This Micro Tutorial will teach you how to the overview of Microsoft Security Essentials. This is a free anti-virus software that guards your PC against viruses, spyware, worms, and other malicious software. This will be demonstrated using Windows…
Suggested Courses

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question