Results 1 to 4 of 4

Thread: [RESOLVED] Output batch file to text file both are in user temp folder

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2003
    Posts
    259

    Resolved [RESOLVED] Output batch file to text file both are in user temp folder

    this works fine in XP bu not with vista and 7 due to permission issues, i think

    Code:
    Shell "C:\Windows\Temp\myinfo.bat C:\Windows\Temp\outfile.txt", vbHide

    so i was thinking about doing something like below but im getting a file not found and the file is there. so i guess the code is wrong but cant get it right

    Code:
    Shell Environ("temp") & "\myinfo.bat" > Environ("temp") & "\outfile.txt"
    when i do
    Code:
    MsgBox Environ("temp")
    the path has spaces and i get "C:\docume~1\" so my code needs to add quotes but cant get the code right. any help?

  2. #2
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,206

    Re: Output batch file to text file both are in user temp folder

    I would be surprised if the UAC lets you write anything to the Windows tree

  3. #3
    Frenzied Member
    Join Date
    Jan 2009
    Location
    Watch Window(Shift+f9)
    Posts
    1,879

    Smile Re: Output batch file to text file both are in user temp folder

    this works fine in XP bu not with vista and 7 due to permission issues, i think
    if it is having permission issue then USER Account Settings Will solve this issue obviously. just minimize the Slider of UAC Down .and then
    try to run the project .hope this might be useful .

  4. #4
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Output batch file to text file both are in user temp folder

    try like
    vb Code:
    1. shell """" & environ("temp") & "\myinfo.bat"""
    same for other path
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width