• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 599
  • Last Modified:

VBScript - Convert DOS Statement to VBScript

Greetings Experts,

I was wondering if you can help me convert a simple DOS statement into VBScript.    In the DOS statement, second file is created that is copied from the original and given a different name.  Once the two files are there, then they are copied to all user's desktop.
CLS
@ECHO OFF
 
echo Creating second Passport session...
copy "c:\program files\passport\sessions\passport.zws" "c:\program files\passport\sessions\pp2.zws"
 
echo Copying shortcut to All Users desktop...
copy "C:\Program Files\Passport\sessions\*.zws" "C:\Documents and Settings\All Users\Desktop"
 
echo Opening 2nd session of Passport...
call "c:\program files\passport\session\pp2.zws"
 
END

Open in new window

0
aceklub97
Asked:
aceklub97
  • 2
1 Solution
 
sirbountyCommented:



Dim objShell : Set objShell = CreateObject("Wscript.Shell")
Dim objFSO : Set objFSO = CreateObject("Scripting.FileSystemObject")
 
SourceFolder = "C:\Program Files\Passport\sessions\"
SourceFile = "passport.zws"
TargetFile = "C:\Program Files\Passport\sessions\pp2.zws"
AllUsersDesktop = objShell.ExpandEnvironmentStrings ("%AllUsersProfile%\Desktop\")
 
objFSO.CopyFile SourceFolder & SourceFile, TargetFile, True
objFSO.CopyFile SourceFolder & "*.zws", AllUsersDesktop, True
 
objShell.Run TargetFile

Open in new window

0
 
aceklub97Author Commented:
Thanks.  That works
0
 
sirbountyCommented:
Glad I could help - thanx for the grade! :^)
0

Featured Post

Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now